Forum Discussion
countif / index / match
Hi Twifoo
Are you able to help me with a formula? I am having trouble with countif/index/match..
I need to look at a range of data (+PLOD'!$H$2:$AX$1048576) and count the number of times a figure appears ($C$1) if the date ('PLOD Sum'!B2) appears in this field ('+PLOD'!$B$2:$B$1048576)
The formula I am using is this:
=IFERROR(COUNTIF(INDEX('+PLOD'!$H$2:$AX$1048576,MATCH('PLOD Sum'!B2,'+PLOD'!$B$2:$B$1048576,0),),$C$1),"No Data")
The issue I am having is there is more than one date row with relevant figures to count, so when I use the above formula it works but is only counting the first row with the relevant date instead of the number of rows with the relevant date... I hope this makes sense?
Thank you in advance!
6 Replies
- TwifooSilver Contributor
Recently, I eschewed the repetition of ISNUMBER-FIND in my reply here:
Similarly, the repetition of SUMPRODUCT in my suggested formula could also be eschewed like this:
IFERROR(1/(1/(
SUMPRODUCT((PLOD1=C1)*
(PLOD2='PLOD SUM'!B2)))),
"No Data")
- TwifooSilver Contributor
Let me rephrase your requirement to this:
COUNT the instances of the value in C1 in the range '+PLOD'!H2:AX1048576, only in rows where the date in 'PLOD SUM'!B2 is found in '+PLOD'!B2:B1048576; otherwise, return "No Data".
The foregoing requirement translates to this formula:
IF(SUMPRODUCT(('+PLOD'!H2:AX1048576=C1)*
('PLOD'!B2:B1048576='PLOD SUM'!B2)),
SUMPRODUCT(('+PLOD'!H2:AX1048576=C1)*
('PLOD'!B2:B1048576='PLOD SUM'!B2)),
"No Data")
- TwifooSilver ContributorInstead of using direct references, define them as dynamic ranges. Thereafter, use those defined names in the formula I suggested.