Right function with single digits in Google sheets

I use the formula =ArrayFormula(left($A2:$C2,1)) to get the first digit of double digit numbers.

if data is 12, the result is 1.

if data is 2, the result is 2.
as expected.

I would like the formula to give 0 when it is a single digit number instead of 2 in the above example. so the formula should treat the data as 02 in this case.

I’d like to do that without changing the data itself.
Is there a way to do this? thanks.

>Solution :

Use

=ArrayFormula(IF(LEN($A2:$C2)=1,0,LEFT($A2:$C2)))

Leave a Reply