Simple array

normpam

Active Member
Joined
Oct 30, 2002
Messages
355
I'm trying to learn about basic array formulas. Following is my example:

Booked Actual
33 32
9 16
8 6
21 30
27 25
16 16
13 43
19 49

Formula: {=sum(c4.c11>=b4.b11)} - entered without the brackets, using CTRL-****-ENTER

The result should be 5 for the number of times that 'actual' is greater than or equal to 'booked'. But I'm getting zero. When I use F9 the formula shows =sum(FALSE;TRUE;FALSE;TRUE;FALSE;TRUE;TRUE;TRUE)

What am I missing here?

Thanks!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You need an If, sumproduct, and/or +0, -- to convert the True/False to 1/0.


Excel 2010
AB
1BookedActual
23332
3916
486
52130
62725
71616
81343
91949
10
115
125
135
Sheet13
Cell Formulas
RangeFormula
B12=SUMPRODUCT(--(B2:B9>=A2:A9))
B11{=SUM(--(B2:B9>=A2:A9))}
B13{=SUM(IF(B2:B9>=A2:A9,1))}
Press CTRL+SHIFT+ENTER to enter array formulas.


Note that sumproduct doesn't require ctrl-shift-enter
 
Last edited:
Upvote 0
This is a logical test and will return true or false.
Code:
=C1:C11>=B1:B11

Excel 2010
BC
13332
2916
386
42130
52725
61616
71343
81949
Sheet5


This should give you want you want with out CSE
Code:
=SUMPRODUCT(--(C1:C8>=B1:B8))

You could use -- to turn the true/false into 1/0 and then sum but you would need CSE
Code:
=SUM(--(C1:C8>=B1:B8))
 
Upvote 0
Thanks... what I was missing was why didn't Excel evaluate the 'True' and 'False' results from the formula as 0's and 1's?
 
Upvote 0
They're sometimes interchangeable (e.g. vlookup accepts true/false or 1/0, so does the address property in VBA). Or you might prefer True/False to distinguish items, like in Goto/specialcells method that can highlight boolean.
 
Last edited:
Upvote 0
Thanks... what I was missing was why didn't Excel evaluate the 'True' and 'False' results from the formula as 0's and 1's?
If you preform a math operation on the true and false results it will become ones and zeros. you can +0, *1 or -- (change the sign then change it back).
 
Upvote 0

Forum statistics

Threads
1,215,223
Messages
6,123,722
Members
449,116
Latest member
Aaagu

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