Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 79
Default macro or formula to get rid of a number

is there a formula that i can drag or macro that allows me to get rid of
specific digits?

Example data:

20
1191
88018
1514
119411
119147
11551123
119146

I need to get rid of all "11" that are in the beginning, however, not if
they are at the end or in the middle.

So the data would look after editing like:

20
91
88018
1514
9411
9147
551123
9146
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default macro or formula to get rid of a number

This is a multi-step process. First, enter this formula in a cell on same
row with your data (presumes the 20 is in A1, and this formula is in B1)

=IF(LEFT(A1,2)="11",RIGHT(A1,LEN(A1)-2),A1)
fill it down the sheet as far as your numbers go, it will remove "11" from
the beginning of any that have it, and leave the others alone. But it has
the effect of converting any numbers changed into text that looks like
numbers.

To fix that, enter a 1 into any empty cell in the worksheet, then select
that cell and choose Edit | Copy
Then select the range of cells where you have the formulas, and use
Edit | Paste Special | [Multiply]
this will put them all into number format again, but the formula is still in
there, so if you do away with anything in A, you'll get an error.

If you want to now convert the formulas to values, select all the cells with
formulas in them (again if you unselected them from before) then Edit | Copy
and then
Edit | Paste Special | [Values]
and the formulas are gone, and you have real numbers in their place.


"A.S." wrote:

is there a formula that i can drag or macro that allows me to get rid of
specific digits?

Example data:

20
1191
88018
1514
119411
119147
11551123
119146

I need to get rid of all "11" that are in the beginning, however, not if
they are at the end or in the middle.

So the data would look after editing like:

20
91
88018
1514
9411
9147
551123
9146

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 79
Default macro or formula to get rid of a number

Looks like i only needed to do the formula, and it worked. Thanks!!!!

"JLatham" wrote:

This is a multi-step process. First, enter this formula in a cell on same
row with your data (presumes the 20 is in A1, and this formula is in B1)

=IF(LEFT(A1,2)="11",RIGHT(A1,LEN(A1)-2),A1)
fill it down the sheet as far as your numbers go, it will remove "11" from
the beginning of any that have it, and leave the others alone. But it has
the effect of converting any numbers changed into text that looks like
numbers.

To fix that, enter a 1 into any empty cell in the worksheet, then select
that cell and choose Edit | Copy
Then select the range of cells where you have the formulas, and use
Edit | Paste Special | [Multiply]
this will put them all into number format again, but the formula is still in
there, so if you do away with anything in A, you'll get an error.

If you want to now convert the formulas to values, select all the cells with
formulas in them (again if you unselected them from before) then Edit | Copy
and then
Edit | Paste Special | [Values]
and the formulas are gone, and you have real numbers in their place.


"A.S." wrote:

is there a formula that i can drag or macro that allows me to get rid of
specific digits?

Example data:

20
1191
88018
1514
119411
119147
11551123
119146

I need to get rid of all "11" that are in the beginning, however, not if
they are at the end or in the middle.

So the data would look after editing like:

20
91
88018
1514
9411
9147
551123
9146

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
macro to repeat a formula a set number of rows apart steveo Excel Discussion (Misc queries) 1 July 10th 06 09:21 PM
macro to repeat a formula a set number of rows apart steveo Excel Discussion (Misc queries) 0 July 10th 06 12:46 AM
countif formula to find the occurances of a number that is greater than one number but less than another steveo Excel Discussion (Misc queries) 3 July 8th 06 02:04 AM
Random number Macro Mike Rogers Excel Discussion (Misc queries) 4 February 25th 06 03:27 AM
Formula for current month minus one = Quarter number in a macro. Pank Excel Discussion (Misc queries) 11 June 22nd 05 02:47 PM


All times are GMT +1. The time now is 04:02 PM.

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

About Us

"It's about Microsoft Excel"