Count multiple conditions

yipppppppy

New Member
Joined
Nov 7, 2013
Messages
19
Office Version
  1. 365
Hi all, the following formula is returning 4 rows. The answer should be 1. I am trying to get the formula to only count a row where it meets all 3 conditions below
1) FY23 TP has an x AND
2) Portfolio is either DI, DD or Digital AND
3) Management Level is 7-Manager OR 6-Analyst

=SUMPRODUCT(--IF(OR('CL7'!D:D="DD",'CL7'!D:D="DI",'CL7'!D:D="Digital"),FILTER(('CL7'!A1:AO1="FY23 TP")*('CL7'!A:AO="x"),'CL7'!C:C="7-Manager")))

IMPORTANT: Can you please update the formula so it is more tighter just incase i need to shuffle these columns around? E.g. if i want to move Management Level to Column Z or any other Column etc. Same with the other two columns Portfolio and FY23 TP

1685837946942.png
 

Attachments

  • 1685837678666.png
    1685837678666.png
    7.9 KB · Views: 17
  • 1685837748750.png
    1685837748750.png
    8.8 KB · Views: 16
  • 1685837817676.png
    1685837817676.png
    8.9 KB · Views: 21

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
You have just demonstrated why we need to have your actual data.
Per Peter's post #7
Images still don't help.
Options:
  • Check for trailing (or leading) space characters with any of the data.
Your heading "Portfolio" has a trailing space "Portfolio "
Your word "Digital" has a trailing space "Digital "
You don't have any DI or DD in your sample data, do they also have trailing spaces, if they do they will have similar issues.

Remove those trailing spaces and you will find that Peter's formula works.
 
Upvote 0
You have just demonstrated why we need to have your actual data.
Per Peter's post #7

Your heading "Portfolio" has a trailing space "Portfolio "
Your word "Digital" has a trailing space "Digital "
You don't have any DI or DD in your sample data, do they also have trailing spaces, if they do they will have similar issues.

Remove those trailing spaces and you will find that Peter's formula works.
Is there a way I can update the formula so it takes care of any headings that has trailing spaces etc?
 
Upvote 0
Try:
Excel Formula:
=LET(h,TRIM('CL7'!A1:AO1),r,'CL7'!A2:AO1000,m,TRIM(INDEX(r,0,MATCH("Management Level",h,0))),p,TRIM(INDEX(r,0,MATCH("Portfolio",h,0))),fy,INDEX(r,0,MATCH("FY23 TP",h,0)),IFNA(ROWS(FILTER(m,((m="7-Manager")+(m="6-Analyst"))*((p="DD")+(p="DI")+(p="Digital"))*(fy="x"),NA())),0))
 
Upvote 0
We could just trim everything at the start
Excel Formula:
=LET(r,TRIM('CL7'!A1:AO1000),h,TAKE(r,1),m,INDEX(r,0,MATCH("Management Level",h,0)),p,INDEX(r,0,MATCH("Portfolio",h,0)),fy,INDEX(r,0,MATCH("FY23 TP",h,0)),IFNA(ROWS(FILTER(m,((m="7-Manager")+(m="6-Analyst"))*((p="DD")+(p="DI")+(p="Digital"))*(fy="x"),NA())),0))
 
Upvote 0
=LET(h,TRIM(Resources!$A$1:$AV$1),r,Resources!$A$2:$AV$998,
m,TRIM(INDEX(r,0,MATCH("Management Level",h,0))),
p,TRIM(INDEX(r,0,MATCH("Portfolio",h,0))),
recommendation,INDEX(r,0,MATCH("Portfolio - Promote, CGL, IP",h,0)),
servicegroup,INDEX(r,0,MATCH("Org Unit Level 3",h,0)),
IFNA(ROWS(FILTER(m,((m="7-Manager"))* ((p="DI")+(p="DD")+(p="Dig"))*
(recommendation="Promote")*
(servicegroup="Bong (Joe)"),
NA())),0))

Can someone advise how i can move the TRIM to the start for the above formula? The formula works but i want to apply the trim at the start rather then at almost every line.
 
Upvote 0
Can someone advise how i can move the TRIM to the start for the above formula?
Try starting with the post #15 formula (that does exactly that) & adapt that to suit what looks like slightly changed conditions.
That is if the post #15 formula provided the correct results for the original question - you have not indicated one way or the other about that.
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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