Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I need 2 formulas
1. a formula to do the following: in A1 is 00003056-021 I need B1 like this - if there are leading zeros then remove first 4 zeros (only 4 and not 5). I need B1 to have 3056021 without the dash. 2. a formula to do the following: in A1 is 30701267-042 I need B1 like this - if there are no leading zeros then remove digits 5-6-7-8 and the dash. I need b1 to have 3070042. Now, how do we combine both formulas? Thank you. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Combine both formulas using an IF function.
=IF(LEFT(A1,1)="0",VALUE(SUBSTITUTE(A1,"-","")),SUBSTITUTE(LEFT(A1,4)&MID(A1,9,LEN(A1)-9),"-","")) -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Vic" wrote: I need 2 formulas 1. a formula to do the following: in A1 is 00003056-021 I need B1 like this - if there are leading zeros then remove first 4 zeros (only 4 and not 5). I need B1 to have 3056021 without the dash. 2. a formula to do the following: in A1 is 30701267-042 I need B1 like this - if there are no leading zeros then remove digits 5-6-7-8 and the dash. I need b1 to have 3070042. Now, how do we combine both formulas? Thank you. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
=SUBSTITUTE(IF(LEFT(A1,4)="0000",RIGHT(A1,LEN(A1)-4),LEFT(A1,4) &
MID(A1,9,256)),"-","") -- Gary''s Student - gsnu200843 "Vic" wrote: I need 2 formulas 1. a formula to do the following: in A1 is 00003056-021 I need B1 like this - if there are leading zeros then remove first 4 zeros (only 4 and not 5). I need B1 to have 3056021 without the dash. 2. a formula to do the following: in A1 is 30701267-042 I need B1 like this - if there are no leading zeros then remove digits 5-6-7-8 and the dash. I need b1 to have 3070042. Now, how do we combine both formulas? Thank you. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Gary,
Your formula worked. Now, I have a little bit more complications. Sometimes, A1 has value like this 1186-1067-188. In this case (with 2 dashes), I need to pick up 1067 (4-digit number between 2 dashes) and 188, so the result will be 1067188. Can this be incorporated into your formula? Thank you. "Gary''s Student" wrote: =SUBSTITUTE(IF(LEFT(A1,4)="0000",RIGHT(A1,LEN(A1)-4),LEFT(A1,4) & MID(A1,9,256)),"-","") -- Gary''s Student - gsnu200843 "Vic" wrote: I need 2 formulas 1. a formula to do the following: in A1 is 00003056-021 I need B1 like this - if there are leading zeros then remove first 4 zeros (only 4 and not 5). I need B1 to have 3056021 without the dash. 2. a formula to do the following: in A1 is 30701267-042 I need B1 like this - if there are no leading zeros then remove digits 5-6-7-8 and the dash. I need b1 to have 3070042. Now, how do we combine both formulas? Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Graph Manipulation | Excel Discussion (Misc queries) | |||
Date Manipulation | Excel Discussion (Misc queries) | |||
Need Help with Cell Manipulation | Excel Discussion (Misc queries) | |||
Text manipulation | Excel Worksheet Functions | |||
Need help with some data manipulation | Excel Worksheet Functions |