Complex array formula

Spraggs

Well-known Member
Joined
Jan 19, 2007
Messages
704
This is way out of my league.....
In the table shown the formula below counts the number of times "QSE" or "CHO" appear in column F when 1042 appears in column D. What I want to do is modify this formula so it counts as above but only the data in column B is within the last 7 days.(TODAY-7).
I then want another formula that counts as above but only the date in column B is older than 7 days.
Array formula
=SUMPRODUCT(--ISNUMBER(MATCH(MID($F$2:$F$1000,6,3),{"QSE","CHO"},0)),--($D$2:$D$1000="1042")).
TEST SHEET.xls
ABCDEFGH
1Created byCreated onNotificationPlanning plantDescriptionFunctLocationSystem statusRoom
2UKFAIRCLKE02/07/2007108121081001unit on line U/S spare unit faulty1001-MIN-MAN-M11-MXP111NOPRLINE 11
3UKMCCAMBR05/07/2007108192431042faulty av 3251042-QSJ-MAN-L02-EC206JOSNOHANDLGJ
4UKPEARMATB10/07/2007108243571001(service) steam leak, T/P1001-MIN-MAN-FON-CNN103NOPRFONDANT
5UKJLEWIS16/07/2007108337481042Toffo sterilant pump1042-TFO-SRV-L01-PZ030OSNOGENKFACT
6UKNAWROCTO19/07/2007108391041042air con leaking water1042-GSV-HEN-CLG-AC094NOPRGENSITE
7UKBROWNRPA20/07/2007108404511042bulbs need replacing on panel1042-QSH-PCK-27F-EC042HOSNOSMALLTIN
8UKPEARMATB25/07/2007108464731001(mech) Drive shaft. T/P1001-MIN-PKW-OUT-TGW146NOPRF/ROOM
9UKELLISDE01/08/2007108563531042lowerator interlock on guard1042-QSH-PCK-26E-EC052HNOPRBULKQSH
10UKFORSTEMA06/08/2007108630251042worn exit belt on lid unscrambler1042-QSH-PCK-27F-EC085HNOPRSMALLTIN
11UKMYERSNI07/08/2007108636371042MB009 Shows 9kgs when vessel is empty1042-QSJ-MAN-L01-MB009OSNOPR26
12UKWISNIERA07/08/2007108637391042Worn drive belts needs replacing1042-QSH-PCK-26E-EC010HNOPRBULKQSH
13UKBETTERIA29/08/2007108909231001(Mech) Conveyor bearing collapsed ?1001-MIN-PKW-OUT-TGW146NOPRF/ROOM
14UKMYERSNI05/09/2007108996841042unable to caustic Clean MB0091042-QSJ-MAN-L01-MB009OSNOPR26
15UKSMITHGA106/09/2007109019561042Place Text Here1042-QSJ-MAN-12A-CS061OSNORNDMFR
16UKWOODMI109/09/2007109047021042Pneumatic tubing trailing on floor1042-QSJ-MAN-13D-EN085NOPROVALMFR
17UKMYERSNI12/09/2007109099921042HK133 Shows 12kgs when vessel is empty1042-QSJ-MAN-13A-HK133OSNOOVALMFR
Job List


Thanks Jase
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,983
You want to add the conditions that
B2>(TODAY()-7) or B2>=(TODAY()-7)

So the formulas would be
Code:
=SUMPRODUCT(--($B$2:$B$1000>(TODAY()-7),--ISNUMBER(MATCH(MID($F$2:$F$1000,6,3),{"QSE","CHO"},0)),--($D$2:$D$1000="1042"))

=SUMPRODUCT(--($B$2:$B$1000<=(TODAY()-7),--ISNUMBER(MATCH(MID($F$2:$F$1000,6,3),{"QSE","CHO"},0)),--($D$2:$D$1000="1042"))
 
Last edited:

gwkenny

Well-known Member
Joined
Aug 13, 2002
Messages
565
Can give this a shot.

=SUMPRODUCT(--ISNUMBER(MATCH(MID($F$2:$F$1000,6,3),{"QSE","CHO"},0)),--($D$2:$D$1000="1042"),--($B$2:$B$1000<=NOW()-7)).

Hope it helps.
 

gwkenny

Well-known Member
Joined
Aug 13, 2002
Messages
565
Ahhh

Mike's use of the TODAY() function probably serves your purposes (and most people's) better. I'm too use to working with people who need the NOW() function.

Thus:

=SUMPRODUCT(--ISNUMBER(MATCH(MID($F$2:$F$1000,6,3),{"QSE","CHO"},0)),--($D$2:$D$1000="1042"),--($B$2:$B$1000<=TODAY()-7)).
 

Spraggs

Well-known Member
Joined
Jan 19, 2007
Messages
704

ADVERTISEMENT

Thanks guys, I'll this a go.
Jase
 

Spraggs

Well-known Member
Joined
Jan 19, 2007
Messages
704
Your answers worked perfect, could I ask your assistance to adapt this a bit further?
Formulas to give:
7-14 days old
14-28 days old.
I've used one the formulas to give me 28 days +
and 0 -7 days old.
Thanks again.
Test page.xls
ABCDEFGHIJK
1Created byCreated onNotificationPlanning plantDescriptionFunctLocationSystem statusRoomE FACTORYQSE / CHO
2UKFAIRCLKE02/07/2007108121081001unit on line U/S spare unit faulty1001-MIN-MAN-M11-MXP111NOPRLINE 110 - 7 DAYS1
3UKMCCAMBR05/07/2007108192431042faulty av 3251042-QSJ-MAN-L02-EC206JOSNOHANDLGJ7 - 14 DAYS
4UKPEARMATB10/07/2007108243571001(service) steam leak, T/P1001-MIN-MAN-FON-CNN103NOPRFONDANT14 - 28 DAYS
5UKJLEWIS16/07/2007108337481042Toffo sterilant pump1042-TFO-SRV-L01-PZ030OSNOGENKFACT28 DAYS +27
6UKNAWROCTO19/07/2007108391041042air con leaking water1042-GSV-HEN-CLG-AC094NOPRGENSITE
7UKBROWNRPA20/07/2007108404511042bulbs need replacing on panel1042-QSH-PCK-27F-EC042HOSNOSMALLTIN
8UKPEARMATB25/07/2007108464731001(mech) Drive shaft. T/P1001-MIN-PKW-OUT-TGW146NOPRF/ROOM
9UKELLISDE23/01/2008108563531042lowerator interlock on guard1042-QSE-PCK-26E-EC052HNOPRBULKQSH
10UKFORSTEMA06/08/2007108630251042worn exit belt on lid unscrambler1042-QSH-PCK-27F-EC085HNOPRSMALLTIN
11UKMYERSNI07/08/2007108636371042MB009 Shows 9kgs when vessel is empty1042-QSJ-MAN-L01-MB009OSNOPR26
12UKWISNIERA07/08/2007108637391042Worn drive belts needs replacing1042-QSH-PCK-26E-EC010HNOPRBULKQSH
13UKBETTERIA29/08/2007108909231001(Mech) Conveyor bearing collapsed ?1001-MIN-PKW-OUT-TGW146NOPRF/ROOM
14UKMYERSNI05/09/2007108996841042unable to caustic Clean MB0091042-QSJ-MAN-L01-MB009OSNOPR26
15UKSMITHGA106/09/2007109019561042Place Text Here1042-QSJ-MAN-12A-CS061OSNORNDMFR
16UKWOODMI109/09/2007109047021042Pneumatic tubing trailing on floor1042-QSJ-MAN-13D-EN085NOPROVALMFR
17UKMYERSNI12/09/2007109099921042HK133 Shows 12kgs when vessel is empty1042-QSJ-MAN-13A-HK133OSNOOVALMFR
18UKSHACKLD19/09/2007109191221042pl0911042-QSJ-MAN-L01-PL091OSNOPR26
19UKMYERSNI20/09/2007109205711042Modification of HK130 Vessel Lid Opener1042-QSJ-MAN-13A-HK130OSNOOVALMFR
20UKBICKNERO24/09/2007109254141042hose handle leaking cream room1042-QSJ-SRV-L01-PZ032OSNOGENJBOT
21UKGILLCO25/09/2007109276761042Condensation dripping from stop valve1042-QSJ-MAN-14G-AC130NOPRECLRWPG
22UKROSEHE27/09/2007109302301042glacier bushes need replacing1042-QSJ-MAN-13G-WI027NOPROVALWPG
23UKWALSHAAD04/10/2007109403971042Removal of camera1042-QSH-PCK-18F-EC387HNOPRKTB18
24UKPEACOCAL15/10/2007109544171042Not adding sterilant to CIP1042-TFO-SRV-L01-PZ030NOPRGENKFACT
25UKNEWTONJO26/10/2007109726771042drive roller sliping pr12 last 2 m/c's1042-QSJ-MAN-12E-CV444NOPRRNDMFR
26UKTORCZYJA31/10/2007109781151042air con leaking online 271042-GSV-HEN-CLG-AC104NOPRGENSITE
Sheet2
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,983

ADVERTISEMENT

AND(TODAY()-7>B2,B2>=TODAY()-14) = TRUE
when if the date B2 is between 7 and 14 days ago.
 

Spraggs

Well-known Member
Joined
Jan 19, 2007
Messages
704
I'm a bit lost with this. Is it possible you could put the full formula so I could cut & paste?
If I write todays date instead of using TODAY the formula now longer works, how would this be written?
Your time is very much appreciated.
Regards Jase
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
You can't use AND with arrays try this

=SUMPRODUCT(--ISNUMBER(MATCH(MID($F$2:$F$1000,6,3),{"QSE","CHO"},0)),--($D$2:$D$1000="1042"),--($B$2:$B$1000>TODAY()-14),--($B$2:$B$1000<=TODAY()-7))

Note: this formula doesn't need CRL+SHIFT+ENTER
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,983
My bad.
AND isn't used with SUMPRODUCT, one needs to multiply to get the same result.

Code:
=SUMPRODUCT(--((TODAY()-7>$B$2:$B$1000)*($B$2:$B$1000>=TODAY()-14)),--ISNUMBER(MATCH(MID($F$2:$F$1000,6,3),{"QSE","CHO"},0)),--($D$2:$D$1000="1042"))
 

Watch MrExcel Video

Forum statistics

Threads
1,129,566
Messages
5,637,085
Members
416,956
Latest member
mitzhaki

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
Top