Using sumproduct with nested arrays

doug firr

Board Regular
Joined
Mar 28, 2011
Messages
140
Here's the formula I'm trying to use:

=SUMPRODUCT((subscriptionType="premium")*(hasPaymentInfo="Yes")*(payDate>='db analysis'!H$20)*(payDate<='db analysis'!H$21)*(OR(cancelDate="-",cancelDate>H21)))

It's not working, I know because I can check by appllying auto filter on the data sheet and counting the rows. It's the nested OR statement, I'm sure of it.

I want to say sumproduct where named range subscription type is premium, hasPaymentInfo is yes, payDate is within a range (7 days) and where cancelDate is either "-" or after the end of the week being analysed (week end date is in H21)

But instead it looks like sumproduct.

Can anyone see a flaw in the logic here?
 
Last edited:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
break it into 2 parts by =if(canceldate="-",(*********************),if(canceldate>h21,*****************))
 
Upvote 0
Here's the formula I'm trying to use:

=SUMPRODUCT((subscriptionType="premium")*(hasPaymentInfo="Yes")*(payDate>='db analysis'!H$20)*(payDate<='db analysis'!H$21)*(OR(cancelDate="-",cancelDate>H21)))

It's not working, I know because I can check by appllying auto filter on the data sheet and counting the rows. It's the nested OR statement, I'm sure of it.

I want to say sumproduct where named range subscription type is premium, hasPaymentInfo is yes, payDate is within a range (7 days) and where cancelDate is either "-" or after the end of the week being analysed (week end date is in H21)

But instead it looks like sumproduct.

Can anyone see a flaw in the logic here?

Try...
Rich (BB code):
=SUMPRODUCT(
  (subscriptionType="premium")*
  (hasPaymentInfo="Yes")*
  (payDate>='db  analysis'!H$20)*
  (payDate<='db  analysis'!H$21)*
  ((cancelDate="-")+(cancelDate>H$21)>0))
 
Upvote 0
Thanks (again) Aladin this is working now. But why? I did try that, except I never included the )>0) part - what's that for?
 
Upvote 0
Test this formula:

Code:
=SUMPRODUCT((subscriptionType="premium")*(hasPaymentInfo="Yes")*(payDate>='db analysis'!H$20)*(payDate<='db analysis'!H$21)*([COLOR="#0000FF"]cancelDate>H21[/COLOR]))

PS: "-" is > H21.

Markmzz
 
Upvote 0
Interesting. So, by saying cancel date is greater than H21 it will already include "-". Why?! Why is "-" greater than h21?
 
Upvote 0
Thanks (again) Aladin this is working now. But why? I did try that, except I never included the )>0) part - what's that for?

A text value like "-" is always > than a number. When "-" holds for a cell along with other conditions, this same cell will score as > H21 that houses a number. The > 0 testing involving the + structure avoids double counting.
 
Upvote 0
Interesting. So, by saying cancel date is greater than H21 it will already include "-". Why?! Why is "-" greater than h21?

In Excel, any caracter (like txt - " ", "-", "a" and "1") is great than any number (by the way, a date in Excel is a number).

Do some tests.

Markmzz
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,442
Members
448,898
Latest member
drewmorgan128

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