Search code examples
excelcountif

Counting the oldest arrears


I have a list of supplier arrears and need a count of total part arrears, but I only want to count a suppliers' oldest arrear.

Supplier Part August September October
A 12345 1 10 0
A 12346 0 5 0
Desired Count 1 1 0

I have tried countif on the columns but do not know how to exclude the newer arrears from the count.


Solution

  • Please try

    =LET(range,$C2:$E3,
    minCol,BYROW(range,LAMBDA(row,MIN(IF(row>0,COLUMN(row))))),
    SUM((C2:C3>0)*(COLUMN(C2:C3)<=minCol)))
    

    in C4 and pulled across

    enter image description here

    or this should spill:

    =LET(range,$C2:$E3,
    minCol,BYROW(range,LAMBDA(row,MIN(IF(row>0,COLUMN(row))))),
    BYCOL(range,LAMBDA(col,SUM((COLUMN(col)<=minCol)*(col>0)))))