View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Luke M Luke M is offline
external usenet poster
 
Posts: 2,722
Default Value manipulation

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.