Count Function????

coccio

Board Regular
Joined
Mar 19, 2002
Messages
156
Office Version
  1. 2016
I want to be able to count how many up figure and down figures in a range

Like this example:

In column A: I have the Month numbered 1-12
In column B: I have the days numbered 1-31
In column C: I have the years from 1988-2003
In column D: are the numbers ranging from positive to negative.

I want to be able to for example find:


12th month in (column A) and the fist day (Column B) and count how many Column D numbers are up. And also how many are down.

How can that be done?
 
if my data is in a different sheet i need to use the inderect formula to make reference to that sheet in order for the formula to work?

here is the formula:

=SUMPRODUCT(--(INDIRECT("West!$C$5:$C$50"):INDIRECT("West!$C$5:$C$50")=Total!$A$1),--(INDIRECT("West!$e$5:$e$50"):INDIRECT("West!$e$5:$e$50")=Total!$A4))

in the sheet west is the data that i need to count
but in the sheet total are the conditions for the count area.

i tryied using the formula without the indirect function but it didnt work.. by adding the inderect function it work. Do you know why??

thanks!

Are you saying that:

=SUMPRODUCT(--(West!$C$5:$C$50=Total!$A$1),--(West!$E$5:$E$50=Total!$A4))

does not work?
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
=SUMPRODUCT(--(E2:E10="UP"),--(F2:F10=2003))

Hi Aladin,

Could you please let me know why did you use the double unary to coerce the numeric expression in column range F here ?

I understand what you are trying to explain but a bit of confusion ;-)
 
Upvote 0
Hi Aladin,

Could you please let me know why did you use the double unary to coerce the numeric expression in column range F here ?

I understand what you are trying to explain but a bit of confusion ;-)

The last term in

=SUMPRODUCT(--(E2:E10="UP"),--(F2:F10=2003))

is a conditional (with an equality test) whose evaluation yields a bunch of TRUE/FALSE's. The -- bit in front of this conditional transforms those TRUE/FALSE results into 1/0's, as needed in the syntax the way the above formula embeds the SumProduct function.
 
Upvote 0
thanks but not understood :-(

What do you exactly mean by conditional ?

If I understand correctly, you mean to say, whenever I force a number to return a boolean value, I have to use the double unary else I do not need to, correct ?
 
Upvote 0
thanks but not understood :-(

What do you exactly mean by conditional ?

The term

F2:F10=2003

is a conditional in that it tests whether a cell in the range of F2:F10 equals 2003. Another way of expressing such a term is:

=IF(F2:F10=2003...

In both forms we get either a TRUE or a FALSE.

With:

--(F2:F10=2003)

we get either 1 or 0. This we call: Coercion. That is coercion from logical (boolean) to numeric.

BTW, the IF version becomes:

=IF(F2:F10=2003,1,0)

If I understand correctly, you mean to say, whenever I force a number to return a boolean value, I have to use the double unary else I do not need to, correct ?

No, we speak of coercion from logical (boolean) or text-number to number, not vice versa.
 
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,321
Members
453,032
Latest member
Pauh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top