#1   Report Post  
Posted to microsoft.public.excel.misc
Vic Vic is offline
external usenet poster
 
Posts: 117
Default Value manipulation

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   Report Post  
Posted to microsoft.public.excel.misc
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.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Value manipulation

=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   Report Post  
Posted to microsoft.public.excel.misc
Vic Vic is offline
external usenet poster
 
Posts: 117
Default Value manipulation

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Graph Manipulation [email protected] Excel Discussion (Misc queries) 2 August 24th 07 04:35 PM
Date Manipulation Greg Excel Discussion (Misc queries) 2 November 7th 06 10:22 PM
Need Help with Cell Manipulation gm Excel Discussion (Misc queries) 2 January 21st 06 10:11 AM
Text manipulation paulinoluciano Excel Worksheet Functions 36 January 12th 06 09:54 AM
Need help with some data manipulation Dan B Excel Worksheet Functions 3 January 5th 06 05:22 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"