Sumifs with nested Or, & comparative operators

CLove511

New Member
Joined
Mar 30, 2015
Messages
3
I currently have an issue with sumifs:

I need to sum a range if:
-The name matches
-The add date is less than the start date
-the disposal date either = "" OR >= the start date

It took me forever to learn this little bit: ">=" & D3 for the criteria.
I just read about making an array for the OR: {1,2;"AB32","A12"}

But how do I combine them?? The array highlights all quotation marks around comparative operators as errors (">=")

This is what I have so far: =SUMIFS('FA Detail'!$D$8:$D$370,'FA Detail'!$C$8:$C$370,Rollforward!$C5,'FA Detail'!$E$8:$E$370,"<="&$D$3,'FA Detail'!$F$8:$F$370,{"",">="&$D$3})

where the columns on the other sheet are C:NAME, D:PRICE, E:ADD DATE, F:DISPOSAL DATE; $D$3 is the start date, and $C5 is the name to match
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try this:

=SUMPRODUCT(--('FA Detail'!$C$8:$C$370=Rollforward!$C5)*--('FA Detail'!$E$8:$E$370<=$D$3)*('FA Detail'!$F$8:$F$370="")+('FA Detail'!$F$8:$F$370>=$D$3),'FA Detail'!$D$8:$D$370)
 
Upvote 0
I currently have an issue with sumifs:



I came up with this:

=SUMIFS('FA Detail'!$D$8:$D$370,'FA Detail'!$C$8:$C$370,Rollforward!C5,'FA Detail'!$E$8:$E$370,"<="&'FA Detail'!$D$3,'FA Detail'!$F$8:$F$370,">="&'FA Detail'!$D$3)

 
Upvote 0
Yeah but if $F$8:$F$370 is blank ("") he still wants to count it... that was the problem... right?
 
Upvote 0
@CLove511

Assuming that the formula is in the sheet called Rollforward...
Rich (BB code):

=SUMPRODUCT(
    SUMIFS(
      'FA Detail'!$D$8:$D$370,
      'FA  Detail'!$C$8:$C$370,$C5,
      'FA  Detail'!$E$8:$E$370,"<="&$D$3,
      'FA Detail'!$F$8:$F$370,CHOOSE({1,2},"",">="&$D$3)))

Does this give you what you need?
 
Upvote 0
Hey Aladin,

Can you explain how the CHOOSE function is working here? I thought it was to choose an action to perform based on the index number... are 1 and 2 the index numbers? What exactly do they do?
 
Upvote 0
Hey Aladin,

Can you explain how the CHOOSE function is working here? I thought it was to choose an action to perform based on the index number... are 1 and 2 the index numbers? What exactly do they do?

CHOOSE is given {1,2} as choices to execute, that is, both 1 and 2, which forces the function to construct an array constant consisting of two values.

Let D3 = 10.

CHOOSE({1,2},"",">="&$D$3)

will deliver:

{"",">=10"}

SUMIFS by ist design can interpret as intended. Note that we need SUMPRODUCT around SUMIFS in order to sum the two values the interpretation generates.
 
Upvote 0
Thanks so much for your help!!

This did the trick:
Code:
=SUMIFS('FA Detail'!$D$8:$D$373,
         'FA Detail'!$C$8:$C$373,C5,
         'FA Detail'!$E$8:$E$373,"<="&$D$3,
         'FA Detail'!$F$8:$F$373,CHOOSE({1,2},"",">="&$D$3))

I didn't understand the SUMPRODUCT, so I cut it out, and it got exactly what I was looking for. The CHOOSE is going to be my go-to solution for this now.
 
Last edited:
Upvote 0
Thanks so much for your help!!

Glad to help.

This did the trick:
Code:
=SUMIFS('FA Detail'!$D$8:$D$373,
         'FA Detail'!$C$8:$C$373,C5,
         'FA Detail'!$E$8:$E$373,"<="&$D$3,
         'FA Detail'!$F$8:$F$373,CHOOSE({1,2},"",">="&$D$3))

I didn't understand the SUMPRODUCT, so I cut it out, and it got exactly what I was looking for. The CHOOSE is going to be my go-to solution for this now.

SUMIFS creates a sum for each criterion it cannot total itself. Hence surrounding SUMPRODUCT which can do just that.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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