Convert All Numbers Stored as Text

turtlepokerman

New Member
Joined
Jun 18, 2012
Messages
28
Hello World,

I have a table of data that looks similar to this:

AB
1Item1Apple
2Item1Weight50
3Item1Height25
4Item2Length10

<tbody>
</tbody>

This structure repeats about 500x. I am importing data currently and the green arrows apprear in the corners and say numbers stored as text for rows B2:B4. How do I select all of the data in column B and have it automatically convert all of the numbers stored as text into numbers while leaving the text items alone? I am willing to work in VBA, since that I already have some functions created in it.

All help is appreciated!!!
 
Formula bar show: 1/0

Cell Format Says:
Category: Custom
Type: General
Okay, give this modification of the code I posted earlier a try...
Code:
Sub ConvertTextNumbersToRealNumbers()
  Dim Addr As String
  Addr = "B1:B" & Cells(Rows.Count, "B").End(xlUp).Row
  Range(Addr).NumberFormat = "@"
  Range(Addr) = Evaluate(Replace("If(ISNUMBER(0+SUBSTITUTE(@,""/"",""X"")),0+@,@)", "@", Addr))
  Range(Addr).NumberFormat = "General"
End Sub
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Grummet,

You method will not work, because I the number format converts the cells that say 1/0 to the date Jan 1.

I think Rick was on the correct path. This will definitely need to be handled by VBA and some conditional statements.
 
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,304
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top