How can i find and change a value in a cell place?

T

toolman

I have part numbers that have 1 or 3 letters followed by 5 numbers. B01234,
or COM12345. I want to right a formula that if the 1st number following the
letter is a 0, replace it with a space. If it is a 1 do nothing.
 
D

Duke Carey

With the part # in A1:

=IF(MID(A1,2,1)="0",LEFT(A1,1)&"
"&MID(A1,3,255),IF(MID(A1,4,1)="0",LEFT(A1,3)&" "&MID(A1,5,255),A1))

Duke
 
D

Duke Carey

toolman -

Be careful with that formula. It will give incorrect results for part #s like

B11011

Try this instead:

=IF(MID(A2,2,1)="0",LEFT(A2,1)&"
"&MID(A2,3,255),IF(AND(ISERROR(VALUE(MID(A2,2,1))),MID(A2,4,1)="0"),LEFT(A2,3)&" "&MID(A2,5,255),A2))
 
Top