0

The function ROW(B:B) doesn't work to display [1, 2, 3, etc.] based on the row.

What I'm trying to do is calculate the number of letter "P"s in the columns G-Z for the specific row. My arrayformula formula (put in B1) is below.

=ARRAYFORMULA(IF(ROW(B:B)=1, "P", IF(A:A = "", "", COUNTIF(INDIRECT("G" & ROW(B:B) & ":Z" & ROW(B:B)), "P"))))

Here's the spreadsheet (image) for reference: https://docs.google.com/spreadsheets/d/1Ry-JM3PRzzKmOIBrXW1Ko9SThJ6w8WHyNLa9vg0kxXA/edit

While similar, this is not the same issue as displayed in this post

Mayukh Bhattacharya
  • 12,541
  • 5
  • 21
  • 32

1 Answers1

1

Use the BYROW function, clear B1 and enter this formula:

={"P";BYROW(G2:ZZZ,LAMBDA(row,IF(COUNTA(row),COUNTIF(row,"P"),)))}

You can also clear B1:F1 and enter this in B1:

=MAP({"P","L","E","U","UC"},LAMBDA(option,{option;BYROW(G2:ZZZ,LAMBDA(row,IF(COUNTA(row),COUNTIF(row,option),)))}))

Update

=ARRAYFORMULA(IF(A:A="",,MAP({"P","L","E","U","UC"},LAMBDA(option,{option;BYROW(G2:ZZZ,LAMBDA(row,COUNTIF(row,option)))}))))
z''
  • 4,527
  • 2
  • 3
  • 12