SUM(IF) using multiple conditons

ssvv

New Member
Joined
May 12, 2011
Messages
22
I am trying to find the sum of a given row using multiple conditions.

Row 1 has the YEAR
Row 2 has the MONTH
Row 7 has the HOURS

I want to sum row 7 where the Year=2008 AND Month=January.

I used the following formulas and got the following results:

=SUM(IF((('Data (OT)'!C1:FE1="2008")+('Data (OT)'!C2:FE2="January")),'Data (OT)'!C7:FE7,0))
This gives me a high number. I believe it gives me the hours where the month is January, but completely ignores the year condition.

However, if I replace the + with * ... =SUM(IF((('Data (OT)'!C1:FE1="2008")*('Data (OT)'!C2:FE2="January")),'Data (OT)'!C7:FE7,0)) the formula gives me a value of 0 (which is inaccurate).


Other formulas I used, which gave me a vlaue of 0:
=SUM(IF('Data (OT)'!C1:FE1="2008",IF('Data (OT)'!C2:FE2="January",'Data (OT)'!C7:FE7)))

=SUMPRODUCT(('Data (OT)'!C1:FE1="2008")*('Data (OT)'!C2:FE2="January")*('Data (OT)'!C7:FE7))


Please advise. Thanks.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
My preference would be SUMPRODUCT - if the year is numeric then you don't need quotes around 2008 so try

=SUMPRODUCT(('Data (OT)'!C1:FE1=2008)*('Data (OT)'!C2:FE2="January"),'Data (OT)'!C7:FE7)
 
Upvote 0
Welcome to the board...

Try Removing the quotes around 2008
The quotes makes it look for a TEXT string "2008", not a NUMBER 2008.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,544
Messages
6,179,430
Members
452,915
Latest member
hannnahheileen

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