Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

countif criteria based on a formula

Status
Not open for further replies.

cboz

Technical User
Dec 24, 2002
42
US
I want to count the number of times the value in cells T251 through AE251 is grater than the value in cell L251*2. The formula below returns Zero when I want it to return 1. The values in T251: AE251 are as follows.

2 32 10 6 8 5 12 9 5 10 7 3

L251*2 = 30 or 15 x 2 = 30

The formula I used is:
=COUNTIF(T251:AE251,">(L251*2)")

Is countif the correct function? I looked up something using sumproduct but I got confused when I learned my arrays would need to have the same dimensions.
 
Your syntax is a little off.

Try
[COLOR=blue white]=COUNTIF(T251:AE251,">"&L251*2)[/color]

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
By the way, just for future reference this forum is for questions about VBA (macros).

Your question should have been posted in forum68, the Microsoft: Office Forum.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Thanks that worked. I don't understand how it works. Why do you need to put the ">" in quotes and add the "&".

Sorry to have asked in the wrong forum. I am usually working on macos when I get stuck and have a question.
 
No problem about the forum - it just helps to keep things tidy to place threads in the proper forum.

Basically what you are doing is building a text string after the comma. You start with [!]">"[/!], which is considered text. The [!]&[/!] is used just like when you concatenate two cells[red]*[/red]. Then the [!]Cell Reference[/!] and [!]*2[/!] finish off the string.

[red]*[/red]If you're not familiar, try this:
In A1, type [blue]Hello[/blue]
In A2, type [blue]there[/blue]
In B1, type [blue]=concatenate(A1," ",A2)[/blue]
[tab]observe result

A shorter way to get the same results is:
In B1, type [blue]= A1 & " " & A2[/blue]

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top