Using SUMPRODUCT and ISNUMBER to find if an array of number has a number included with special conditions

Lekazard

New Member
Joined
May 25, 2023
Messages
11
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I'm banging my head with this issue and help would be highly appreciated.
I have some data gathered monthly and to sum it up I need to discover if midweek holidays are included within a range of dates. For simplicity the relevant data on the sheet is structured like this:
D: Dates I'm comparingH: Date rangeI: Expected output values
4453644531; 44532; 44533; 44537; 44538; 44539; 44540FALSE
4455644531; 44532; 44533; 44537; 44538; 44539; 44540; 44550; 44551; 44552; 44553FALSE
4455944531; 44532; 44533; 44537; 44538; 44539; 44540; 44550; 44551; 44552; 44553; 44557; 44558; 44559; 44560; 44561TRUE

What I want to know is does the the array listed in column H have any of the numbers listed in column D with the special rule there must be one consecutive datevalue before and 2 after (to simplify, if the number we are comparing is 2, then an array of 1, 2, 3, 4 would give TRUE).
The two formulas I've tried to use in column I are:
=IF(AND(ISNUMBER(MATCH(D2-1; $H$2:$H$1000; 0)); OR(ISNUMBER(MATCH(D2+2; $H$2:$H$1000; 0)); ISNUMBER(MATCH(D2+3; $H$2:$H$1000; 0)))); TRUE; FALSE)
and
=IF(SUMPRODUCT(--(ISNUMBER(MATCH(D2:D1000-1; $H$2:$H$1000; 0))); --(ISNUMBER(MATCH(D2:D1000+2; $H$2:$H$1000; 0))); --(ISNUMBER(MATCH(D2:D1000+3; $H$2:$H$1000; 0)))) > 0; TRUE; FALSE)
but both give FAIL for every row meaning, that they are not compiled right. Because of localization I use semicolon as the separator inside formulas. Could anyone help me out with this one because my head is really starting to hurt.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Maybe:
Book1
ABC
24453644531; 44532; 44533; 44537; 44538; 44539; 44540FALSE
34455644531; 44532; 44533; 44537; 44538; 44539; 44540; 44550; 44551; 44552; 44553FALSE
44455944531; 44532; 44533; 44537; 44538; 44539; 44540; 44550; 44551; 44552; 44553; 44557; 44558; 44559; 44560; 44561TRUE
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=IF(COUNTA(LET(ts,--TEXTSPLIT(B2,";"),FILTER(ts,(ts>=A2-1)*(ts<=A2+2))))<4,FALSE,TRUE)
 
Upvote 0
For 365 how about
Fluff.xlsm
DHI
1
24453644531; 44532; 44533; 44537; 44538; 44539; 44540FALSE
34455644531; 44532; 44533; 44537; 44538; 44539; 44540; 44550; 44551; 44552; 44553FALSE
44455944531; 44532; 44533; 44537; 44538; 44539; 44540; 44550; 44551; 44552; 44553; 44557; 44558; 44559; 44560; 44561TRUE
Master
Cell Formulas
RangeFormula
I2:I4I2=SUM(--(ISNUMBER(MATCH(SEQUENCE(4,,D2-1),TEXTSPLIT(H2,";")+0,0))))=4
 
Upvote 0
Big thanks for trying to help me. I tried both methods: =ISNUMBER(FIND("; "&$D2&"; ","; "&$H2&"; ")) and =IF(COUNTA(LET(ts,--TEXTSPLIT(B2,";"),FILTER(ts,(ts>=A2-1)*(ts<=A2+2))))<4,FALSE,TRUE), but for every row it unfortunately gives the result FAIL.

Could there be something wrong with either the settings and localization or the way the data is formatted in my sheet?
 
Upvote 0
Did you try the formula I suggested?
 
Upvote 0
Did you swap the , for ; in the formulae you tried?

Depending on language sometimes the function names can also be different (I think)
 
Upvote 0
Did you try the formula I suggested?
I did. Thanks for trying to help, but for every row it only returns FAIL

Did you swap the , for ; in the formulae you tried?

Depending on language sometimes the function names can also be different (I think)
Yes, in my localized Excel semicolon is the separator and for every formula I try I always replace commas into semicolons because otherwise it only gives the error popup.
 
Upvote 0
If you put
Excel Formula:
=len(d4)
into a cell what does it return?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,171
Members
453,021
Latest member
Justyna P

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