Google Sheets: Adjusting an array formula to auto-appear in every row

Try this:

=ARRAYFORMULA(
  IF(
    H2:H = "",
      "",
      IF(
        MOD(
          MMULT(
              MID(REPT("0", 20 - LEN(H2:H)) & H2:H, SEQUENCE(1, 10, 2, 2), 1)
            + MID(REPT("0", 20 - LEN(H2:H)) & H2:H, SEQUENCE(1, 10, 1, 2), 1) * 2
            - (MID(REPT("0", 20 - LEN(H2:H)) & H2:H, SEQUENCE(1, 10, 1, 2), 1) * 2 > 9) * 9,
            SEQUENCE(10, 1, 1, 0)
          ),
          10
        ) = 0,
          "✔",
          "❌"
      )
  )
)

enter image description here

If you want a more general solution (for card numbers longer than 20 digits), replace 20 with MAX(LEN(H2:H)) + MOD(MAX(LEN(H2:H)), 2), and 10 with (MAX(LEN(H2:H)) + MOD(MAX(LEN(H2:H)), 2)) / 2.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top