Search code examples
excelexcel-formula

Excel - Check existing digit count, if <10 then add prefix "100" to make it 10 digit


I have a column where I expect it to be 10 digits (starting with '100...'). I know how to check the length with LEN but I am not able to combined with IF statement where if <10 then it should add prefix '100'.

Your help in right direction is appreciated.


Solution

  • Maybe this is what you are looking for:

    =RIGHT("1" & IFERROR(REPT("0",9-LEN(A1)),"") & A1,10)
    

    enter image description here