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: 5
  • 1685837748750.png
    1685837748750.png
    8.8 KB · Views: 4
  • 1685837817676.png
    1685837817676.png
    8.9 KB · Views: 5

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I would strongly recommend against using whole column references in a SUMPRODUCT formula. below I have used down to row 1,000. Just make sure that is a big enough number to cover any data you might have,

yipppppppy.xlsm
CDAE
1Management LevelPortfolioFY23 TP
27-Managerx
36-Analystx
47-ManagerDDx
5x
67-ManagerDD
7x
8x
97-ManagerDIx
10
11dDigitalx
12x
13
CL7


Try this formula for the count

yipppppppy.xlsm
A
12
Sheet2
Cell Formulas
RangeFormula
A1A1=LET(h,'CL7'!A1:AO1,r,'CL7'!A2:AE1000,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")*((p="DD")+(p="DI")+(p="Digital"))*(fy="x"),NA())),0))
 
Upvote 0
Thanks. Your formula returned zero as per second screenshot below. Please note: First screenshot is in a seperate tab (Tab name is CL7) to the second screenshot (Tab name is Sheet 1)

1685841679104.png


1685841749388.png
 
Upvote 0
Also i think your formula doesnt factor in any rows the third condition if a row met the first two points below and the third point is an 6-Analyst.

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

The answer should be 1, not 0 based on the table i pasted just above.
 
Upvote 0
You can see that the formula worked for me. That indicates likely something different about your data but we can't tell much from an image.
Can you post those two small sheet sections again, but with XL2BB* so we can copy to test with your data, not ours?

* .. or as I mentioned in my conversation message to you about another thread.

3) Management Level is 7-Manager OR 6-Analyst
Yes, I missed that OR and will address that when the other problem is resolved.
 
Upvote 0
Hi,

Unfortunately it is not allowing me to add it as it is being blocked by my organisation (its a work computer).

I have copied the full screenshot including the tab for each if it helps?



1685842927660.png


1685842989385.png
 
Upvote 0
Images still don't help.
Options:
  • Check for trailing (or leading) space characters with any of the data.
  • Start a new test workbook and manually type in a few values in those columns and test that. Or you can copy my test data with this:
    1685843974327.png
  • Share a dummy workbook as I suggested in my conversation message.
With the missed condition ..

yipppppppy.xlsm
CDAE
1Management LevelPortfolioFY23 TP
27-Managerx
36-Analystx
47-ManagerDDx
5x
67-ManagerDD
76-AnalystDigitalx
8x
97-ManagerDIx
10
11dDigitalx
12x
CL7


yipppppppy.xlsm
A
13
Sheet 1
Cell Formulas
RangeFormula
A1A1=LET(h,'CL7'!A1:AO1,r,'CL7'!A2:AO1000,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))
 
Last edited:
Upvote 0
@yipppppppy
I think that you may have looked at an incorrect version of my last post. I had an error in the Sheet 1 formula in that I was referencing a different number of columns for the main data compared to the headings. I have since edited the mini sheet with the formula to correct that. Both headings and data now look at columns A:AO. 😎
 
Upvote 0
Ok no worries. I have literally deleted the CL7 tab with all the data there. Created a completely new tab titled CL7 and entered only the following to the new CL7 tab. Copied the raw data below and the corresponding screenshot further below.

Once i copy this formula to the Sheet1 tab i still get zero.

=LET(h,'CL7'!A1:AN1,r,'CL7'!A2:AD1000,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))


Management LevelPortfolioFY23 TP
6-AnalystRedx
7-ManagerYellowx
7-ManagerDigitalx
dDigitalx
7-ManagerYellowx


1685845024456.png
 

Attachments

  • 1685844909014.png
    1685844909014.png
    16.2 KB · Views: 6
Upvote 0

Forum statistics

Threads
1,215,357
Messages
6,124,482
Members
449,165
Latest member
ChipDude83

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