ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How can i find and change a value in a cell place? (https://www.excelbanter.com/excel-worksheet-functions/70979-how-can-i-find-change-value-cell-place.html)

toolman

How can i find and change a value in a cell place?
 
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.

Duke Carey

How can i find and change a value in a cell place?
 
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

"toolman" wrote:

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.


Duke Carey

How can i find and change a value in a cell place?
 
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))



"Duke Carey" wrote:

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

"toolman" wrote:

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.



All times are GMT +1. The time now is 11:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com