Forum Discussion

manish4993395's avatar
manish4993395
Copper Contributor
Sep 21, 2023
Solved

Count occurrence if the any of the next columns have blank

Hi Experts,   I want to count the 'Shopping' for every row if any next column is having a NULL value. If there is no NULL value column then it should not be counted. Please take the 'result' column...
  • PeterBartholomew1's avatar
    PeterBartholomew1
    Sep 21, 2023

    manish4993395 

    This last change came as a bit of a surprise!  Up to there my solutions were the same as HansVogelaar and JosWoolley.  To count occurrences I changed the formula to

    Worksheet formula
    = BYROW(table, CountBeforeλ("Shopping", "NULL"))
    
    CountBeforeλ
    = LAMBDA(countString, untilString, LAMBDA(line,
        LET(
            end,     XMATCH(untilString, line, , -1),
            matches, TAKE(line, , end) = countString,
            IFERROR(SUM(SIGN(matches)), 0)
        )
      ))

Resources