Forum Discussion

GhostCrab's avatar
GhostCrab
Copper Contributor
Aug 05, 2025
Solved

COUNTIF returns error in a dynamic array

Hello. I have a formula, and it seems like the last COUNTIF would return "Error in Value", it returns error when it is used in this context.
It works when I separate the result part of this LET formula to another cell, I would want it to be in the same cell, so I want to know what is wrong with this formula.
Thank you in advance

=LET(
  moves, B2:B5,
  move1,INDEX(moves,1),
  move2,INDEX(moves,2),
  move3,INDEX(moves,3),
  move4,INDEX(moves,4),
  learnsets, learnset!A2:F5420,
  dexcol, INDEX(learnsets, ,1),
  movecol, INDEX(learnsets, ,3),
matches,FILTER(learnsets,
(IF(ISBLANK(move1),FALSE,movecol=move1))+
(IF(ISBLANK(move2),FALSE,movecol=move2))+
(IF(ISBLANK(move3),FALSE,movecol=move3))+
(IF(ISBLANK(move4),FALSE,movecol=move4))
),
matchesdexcol,INDEX(matches,,1),
results,FILTER(matches,COUNTIF(matchesdexcol,matchesdexcol)=COUNTA(moves)),
COUNTIF(matchesdexcol,matchesdexcol)
)

  • COUNTIF only works with a range as first argument, not with an array. So COUNTIF(matchesdexcol,matchesdexcol) causes an error.

1 Reply

  • COUNTIF only works with a range as first argument, not with an array. So COUNTIF(matchesdexcol,matchesdexcol) causes an error.

Resources