sum & sumif questions

Ice5

New Member
Joined
Mar 31, 2002
Messages
9
Sum works properly in the following instance:

=sum(j8:m120)

This sums all the values in between those two cells.

However in a sumif function:

=sumif(b8:b120,CONDITION,j8:m120)

I get some whacked out answer. It's not the sumer of the cells. Why does that (j8:m12) work in the sumif, but does work in the sum function?

Thanks
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
The condition is ">"&today()-30*x where x is the number of months.

Well this is for a pilot log book

Column B contains dates
Columns J through M contain flight times.

I have an equation to total the times for the past x months (1, 6, & 12).

The following works and returns the correct totals:

=SUMIF(B7:B9999,">"&TODAY()-30,J7:J9999)
+SUMIF(B7:B9999,">"&TODAY()-30,K7:K9999)
+SUMIF(B7:B9999,">"&TODAY()-30,L7:L9999)
+SUMIF(B7:B9999,">"&TODAY()-30,M7:M9999)

Howerver this doesn't work:

=SUMIF(B7:B9999,">"&TODAY()-30,J7:M9999)


EDIT: Formatting
This message was edited by Ice5 on 2002-04-01 12:56
 
Upvote 0
When you enter your formula, are you entering it by pressing Ctr+shift+enter instead of just enter. Look up how to enter an array formula (CSE formula).
 
Upvote 0
I hadn't tried CTRL + SHIFT + ENTER.

I tried it now however, and same deal.

i.e.

=SUMIF(B8:B10000,">"&TODAY()-30*6,J8:M10000)

Still does not return the correct value (it returns 0.9 instead of 21.5)
This message was edited by Ice5 on 2002-04-01 13:04
 
Upvote 0
Ice,

your ranges are unequal size....

see in your individual sumifs, they are all equal in size so individually you get correct results
 
Upvote 0
On 2002-04-01 12:53, Ice5 wrote:
The condition is ">"&today()-30*x where x is the number of months.

Well this is for a pilot log book

Column B contains dates
Columns J through M contain flight times.

I have an equation to total the times for the past x months (1, 6, & 12).

The following works and returns the correct totals:

=SUMIF(B7:B9999,">"&TODAY()-30,J7:J9999)
+SUMIF(B7:B9999,">"&TODAY()-30,K7:K9999)
+SUMIF(B7:B9999,">"&TODAY()-30,L7:L9999)
+SUMIF(B7:B9999,">"&TODAY()-30,M7:M9999)

Howerver this doesn't work:

=SUMIF(B7:B9999,">"&TODAY()-30,J7:M9999)


EDIT: Formatting
This message was edited by Ice5 on 2002-04-01 12:56

SUMIF requires ranges of equal size. Thus,

=SUMIF(B7:B9999,">"&TODAY()-30,J7:M9999)

cannot replace your larger formula that adds up the results of independent SUMIFs.

If you insist on a single formula, use:

=SUMPRODUCT((B7:B9999>TODAY()-30)*(J7:M9999))

Aladin
 
Upvote 0
Oh, neat.

Thanks Aladin.

I don't REQUIRE only one formula, but otherwise I'd have 10 separate forumla's. Just ugly and hard to work on.

the SUMPRODUCT function works out perfectly though, thanks.
 
Upvote 0

Forum statistics

Threads
1,214,416
Messages
6,119,386
Members
448,891
Latest member
tpierce

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