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


I have a user interface which stores the inputted data onto a separate sheet
however when I come to pull the total amount off of the data sheet it wont
pick it up, the cell is asking me to Convert numbers stored as text to
number. I can get it to pick up if I manually change it so it converts to a
number but I want the macro to do this for me automatically, does anyone have
any ideas? For example if i do a basic =Sum(A1:A5) then it will not pick up
the text number however =sum(A1+A2+A3+A4+A5) will. Your help is appreciated

Kind regards

Rob Evans
07869214171

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default convert text to number

First - find out why you are storing numbers as text in the first place -
should be able to fix the problem there.

If not, the standard way to convert taxt back to numbers is to copy a cell
containing the number 1 and paste special / multiply (alt+e, s, m on the
keyboard) onto your cells containing numbers stored as text values.

So in code you would need something like:

Dim rng1 As Range 'cellcontaining the number 1
Dim rngText As Range 'range containg your text numbers

rng1.Copy
rngText.PasteSpecial Operation:=xlPasteSpecialOperationMultiply

"Robjevans83" wrote:


I have a user interface which stores the inputted data onto a separate sheet
however when I come to pull the total amount off of the data sheet it wont
pick it up, the cell is asking me to Convert numbers stored as text to
number. I can get it to pick up if I manually change it so it converts to a
number but I want the macro to do this for me automatically, does anyone have
any ideas? For example if i do a basic =Sum(A1:A5) then it will not pick up
the text number however =sum(A1+A2+A3+A4+A5) will. Your help is appreciated

Kind regards

Rob Evans
07869214171

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default convert text to number

One way:
=SUMPRODUCT(--(A1:A5))

Personally, I think I'd fix the range so that it's really numbers. You may
remember to fix this one formula, but I would be scared that I'd miss references
in other formulas.

I use this technique:
Select an empty cell
Edit|copy
Select the range to fix
Edit|paste special|check Add and values.



Robjevans83 wrote:

I have a user interface which stores the inputted data onto a separate sheet
however when I come to pull the total amount off of the data sheet it wont
pick it up, the cell is asking me to Convert numbers stored as text to
number. I can get it to pick up if I manually change it so it converts to a
number but I want the macro to do this for me automatically, does anyone have
any ideas? For example if i do a basic =Sum(A1:A5) then it will not pick up
the text number however =sum(A1+A2+A3+A4+A5) will. Your help is appreciated

Kind regards

Rob Evans
07869214171


--

Dave Peterson
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
Convert text number to number formate [email protected] Excel Discussion (Misc queries) 2 April 9th 07 10:48 AM
Convert a number formatted as text to a number in a macro MACRE0[_5_] Excel Programming 2 October 22nd 05 02:51 AM
convert text-format number to number in excel 2000%3f Larry Excel Discussion (Misc queries) 1 July 29th 05 08:18 PM
not able to convert text, or graphic number to regular number in e knutsenk Excel Worksheet Functions 1 April 2nd 05 08:41 AM
Convert number in text format to number Cheryl[_3_] Excel Programming 2 May 25th 04 06:51 PM


All times are GMT +1. The time now is 11:04 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"