Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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)))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading