I am trying to count records that are located in different rows which:
MATCH
by finding the row of the cell that contains "Negative Comment 1" and MATCH
the row number of the cell that contains "Negative Comment 5" (eg. "Negative 1" is in Row 220, "Negative 5" is in row 224, hence the rance would be I220:AZZ224 which spans 5 rows) Formula looks like this:
=IFERROR(COUNTIFS(
// starting date
'MED-FB-YTD'!$I$18:$AZZ$18,">="&DATE(YEAR(E3),MONTH(E3),"1")-1,
// end date
'MED-FB-YTD'!$I$18:$AZZ$18,"<"&DATE(YEAR(E3),MONTH(E3),"31"),
// define range between Negative Comment 1 to 5 and count all records that are not empty
INDIRECT("'MED-FB-YTD'!$I$"&MATCH("Negative Comment 1",'MED-FB-YTD'!$C:$C,0)&":$AZZ$"&MATCH("Negative Comment 5",'MED-FB-YTD'!$C:$C,0)),"<>"),
"ERR")
The problem is here
// define range between Negative Comment 1 to 5 and count all records that are not empty
INDIRECT("'MED-FB-YTD'!$I$"&MATCH("Negative Comment 1",'MED-FB-YTD'!$C:$C,0)&":$AZZ$"&MATCH("Negative Comment 5",'MED-FB-YTD'!$C:$C,0)),"<>"),
The formula works fine if I change the range to count from 5 rows to 1 row (eg. change from I220:AZZ224
to I220:AZZ220
), which leads me to believe that the countifs()
formula doesnt like to count cells across multiple rows, which in turn however is unlikely as I used countifs()
before and did just that.
Right now, I am always getting the #value
error. Any suggestions?
EDIT
Sample data below:
MED-FB-YTD (data source):
Display form:
There seems to be something missing in the formula which you have pasted at the end (I mean in your problematic line).
Can you re-share your formula?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.