0

I have spreadsheet and I need a way to format the formula so that the first column have two leading zeros (000) and the second column to have one leading zero (00) Minimum required code:

=ARRAYFORMULA(
  IF(ISBLANK(C2:C),,
   COUNTIFS(
    C2:C,C2:C,
    ROW(C2:C),"<="&ROW(C2:C))))
1
  • What do you mean? You provided a formula that creates a 1 column array of 1's and `` blanks. 1's if there is anything in the column C including numbers, text strings, etc. Is this your homework? How about an example of before and after.
    – Blindspots
    May 20, 2023 at 6:00

1 Answer 1

1

To format your columns with leading zeros, you can use the TEXT function in Google Sheets. This function allows you to specify a custom number format. This might work:

=ARRAYFORMULA(
  IF(ISBLANK(C2:C),,
   TEXT(COUNTIFS(
    C2:C,C2:C,
    ROW(C2:C),"<="&ROW(C2:C)), "000")&":"&TEXT(COUNTIFS(
    C2:C,C2:C,
    ROW(C2:C),"<="&ROW(C2:C)), "00")))

Let me know if that works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.