= IF((5 & gt; = COLUMN(a 1))*($ h 1 & lt; & gt""),- MID(REPT(0,5-LEN($ h 1))& amp; $H 1, column (A 1), 1), "")
Higher than EXCEL 2003 version, you can also use this formula:
=IF($H 1= ""," ",IFERROR( - MID(REPT(0,5-LEN($ h 1))& amp; $H 1, column (A 1), 1), ""))