Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default extracting a number

I have a column (A) of 300+ rows, with 10 digits in each cell. I need to
remove the last digit of each cell.

I tried =LEFT(A2,9) on column B and then copied the fomula to the last row,
but when I deleted column A, coumn B gave me a #REF! error. Is there a way to
convert those number in column B?

Or another way to do this without the use of =LEFT function?

TIA

Hernan.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default extracting a number

PasteSpecial - Values... when you past back to column A. Otherwise you are
pasting a formula that is referencing the column to the left of A which does
not exist...
--
HTH...

Jim Thomlinson


"Hernan" wrote:

I have a column (A) of 300+ rows, with 10 digits in each cell. I need to
remove the last digit of each cell.

I tried =LEFT(A2,9) on column B and then copied the fomula to the last row,
but when I deleted column A, coumn B gave me a #REF! error. Is there a way to
convert those number in column B?

Or another way to do this without the use of =LEFT function?

TIA

Hernan.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default extracting a number

Hernan,

Maybe this will accomplish your task without using the "LEFT" function

Counter = 1 ' Set the value to the row number of the cell containing the
first value
Do Until ActiveSheet.Cells(Counter,1) = "" ' This only works if there
is a blank cell after your last value and the values are in column A
ActiveSheet.Cells(Counter,1).Value =
INT(ActiveSheet.Cells(Counter,1)/10)
Counter = Counter+1
Loop

If you want column A to retain the original value and column B to contain
the cell value without the last digit, then the 1st line in the DO loop
should read

ActiveSheet.Cells(Counter,2).Value = INT(ActiveSheet.Cells(Counter,1)/10)

Good luck.

Boog

"Hernan" wrote in message
...
I have a column (A) of 300+ rows, with 10 digits in each cell. I need to
remove the last digit of each cell.

I tried =LEFT(A2,9) on column B and then copied the fomula to the last
row,
but when I deleted column A, coumn B gave me a #REF! error. Is there a way
to
convert those number in column B?

Or another way to do this without the use of =LEFT function?

TIA

Hernan.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default extracting a number

Hernan,

Maybe this will accomplish your task without using the "LEFT" function

Counter = 1 ' Set the value to the row number of the cell containing the
first value
Do Until ActiveSheet.Cells(Counter,1) = "" ' This only works if there
is a blank cell after your last value and the values are in column A
ActiveSheet.Cells(Counter,1).Value =
INT(ActiveSheet.Cells(Counter,1)/10)
Counter = Counter+1
Loop

If you want column A to retain the original value and column B to contain
the cell value without the last digit, then the 1st line in the DO loop
should read

ActiveSheet.Cells(Counter,2).Value = INT(ActiveSheet.Cells(Counter,1)/10)

Good luck.

Boog

"Hernan" wrote in message
...
I have a column (A) of 300+ rows, with 10 digits in each cell. I need to
remove the last digit of each cell.

I tried =LEFT(A2,9) on column B and then copied the fomula to the last
row,
but when I deleted column A, coumn B gave me a #REF! error. Is there a way
to
convert those number in column B?

Or another way to do this without the use of =LEFT function?

TIA

Hernan.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default extracting a number

Hernan,

Maybe this will accomplish your task without using the "LEFT" function

Counter = 1 ' Set the value to the row number of the cell containing the
first value
Do Until ActiveSheet.Cells(Counter,1) = "" ' This only works if there
is a blank cell after your last value and the values are in column A
ActiveSheet.Cells(Counter,1).Value =
INT(ActiveSheet.Cells(Counter,1)/10)
Counter = Counter+1
Loop

If you want column A to retain the original value and column B to contain
the cell value without the last digit, then the 1st line in the DO loop
should read

ActiveSheet.Cells(Counter,2).Value = INT(ActiveSheet.Cells(Counter,1)/10)

Good luck.

Boog

"Hernan" wrote in message
...
I have a column (A) of 300+ rows, with 10 digits in each cell. I need to
remove the last digit of each cell.

I tried =LEFT(A2,9) on column B and then copied the fomula to the last
row,
but when I deleted column A, coumn B gave me a #REF! error. Is there a way
to
convert those number in column B?

Or another way to do this without the use of =LEFT function?

TIA

Hernan.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default extracting a number


If the idea is to extract the last digit of your 10-digit number
(assuming they are all uniformly so), simply use the the RIGH
function: no need for code.

In Column B, *=Right(A2,1) and fill down*


Before you delete Colum A, make sure the formulas in Column B ar
converted to numbers. You do this by highlighting Column B,
PasteSpecial-----Values. You were probably getting #REF! error by no
performing this conversion

--
david
-----------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064
View this thread: http://www.excelforum.com/showthread.php?threadid=38697

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default extracting a number

Thanks to all that replied.

Jim got it first though.

Thanks Jim!


"Jim Thomlinson" wrote:

PasteSpecial - Values... when you past back to column A. Otherwise you are
pasting a formula that is referencing the column to the left of A which does
not exist...
--
HTH...

Jim Thomlinson


"Hernan" wrote:

I have a column (A) of 300+ rows, with 10 digits in each cell. I need to
remove the last digit of each cell.

I tried =LEFT(A2,9) on column B and then copied the fomula to the last row,
but when I deleted column A, coumn B gave me a #REF! error. Is there a way to
convert those number in column B?

Or another way to do this without the use of =LEFT function?

TIA

Hernan.

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
Extracting the data according to the number of cell wilchong via OfficeKB.com New Users to Excel 4 May 13th 08 02:28 AM
Extracting number from Text and () Confused Excel Discussion (Misc queries) 15 March 13th 07 12:20 PM
Help!!! Extracting a number to line up with a different number lpdc Excel Discussion (Misc queries) 4 June 13th 06 08:40 PM
Extracting a 'number' from text Anthony Slater Excel Discussion (Misc queries) 4 April 5th 05 01:47 PM
Extracting the number from a text Venkatesh V Excel Discussion (Misc queries) 1 February 23rd 05 04:27 PM


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

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"