Conditional Sum...

KanMan

Board Regular
Joined
Dec 4, 2005
Messages
100
I have the following array formula:

{=SUM(IF((PM=INDEX(Name,ROW($A1)))*((ISNUMBER(MATCH(Date,MajorHolidays,0)))+(ISNUMBER(MATCH(Day,FridayWeekEnd,0)))+(ISNUMBER(MATCH(Day,WeekEnd,0)))+(ISNUMBER(MATCH(Date,MinorHolidays,0)))+(ISNUMBER(MATCH(Date,FridayWeekEnd,0)))),1))*WeekDayPMhours}

I want the SUM to occur only if the first condition (PM=INDEX...) is true and all the other conditions are not. I have tried various combinations of AND (*), OR(+) and NOT(-) but it just doesn't work.

Any ideas.

Thanks.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hotpepper:

Thanks for the reply. Appreciate it very much. It still doesn't work though. I tried the Conditional Sum Wizard and came up with this formula:

{=SUM(IF(PM=INDEX(Name,ROW($A1)),IF(Date<>DATEVALUE("7/4/2011"),IF(Date<>DATEVALUE("9/5/2011"),IF(Day<>"Friday",IF(Day<>"Saturday",IF(Day<>"Sunday",1,0),0),0),0),0),0))}

This works but is cumbersome and I would have to copy it into many cells and would have to redo it each quarter. Sort of defeats the purpose of using Excel if not the entire computer. Instead of Date referencing each date how can I make it refer to a range "MajorHolidays".

Thanks again.
 
Upvote 0
Hotpepper:

Thanks for the reply. Appreciate it very much. It still doesn't work though. I tried the Conditional Sum Wizard and came up with this formula:

{=SUM(IF(PM=INDEX(Name,ROW($A1)),IF(Date<>DATEVALUE("7/4/2011"),IF(Date<>DATEVALUE("9/5/2011"),IF(Day<>"Friday",IF(Day<>"Saturday",IF(Day<>"Sunday",1,0),0),0),0),0),0))}

This works but is cumbersome and I would have to copy it into many cells and would have to redo it each quarter. Sort of defeats the purpose of using Excel if not the entire computer. Instead of Date referencing each date how can I make it refer to a range "MajorHolidays".

Thanks again.

Try...
Code:
=SUM(
    IF(PM=INDEX(Name,ROWS($A$1:A1)),
    IF(1-ISNUMBER(MATCH(Date,{"7/4/2011","9/5/2011"}+0,0)),
    IF(1-ISNUMBER(MATCH(Day,{"Friday","Saturday","Sunday"},0)),
      1))))

If you are on Excel 2007 or later, try a formula with COUNTIFS instead.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,248
Members
452,900
Latest member
LisaGo

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