Convert Imported Values, Being Seen As Text, To True Numbers
Jan 28, 2010
I have a document passed to me that includes information pulled from an internal system.
I want to use some basic formulas to show Totals, averages etc.
However, the SUM function does not work on the data provided unless I select the cell (As if to edit the text) and the press enter.
Is there a quicker way of selecting all of the cells in Column A for example and performing this function on mass, rather than selecting each cell individually.
I have attahced a similar sample copy - My SUM formula is show in cell B15.
Following is the master data that's imported from weekly timesheet.
DeptProjNoProjNameEmployee Dept170000Project1Shawn Johnson Dept170000Project1Brenda Larry Dept260010Project2Patrick Leh Dept170010Project3Shawn Johnson
When imported, the 'ProjNo' is stored in Text format. Now when forecast data is appended to master table, the ProjNo stores as Numbers. I would like to know how I can automatically convert it into Text. The number of records varies every time when imported from the Timesheet.
The other thing is I need AutoFill 'APPROVED' in Column 5 from 2nd row to the last row.
I have a very large spreadsheet that comes out of SAP and it brings out the majority of cell entries as text ie putting a ' at the begining of any number. the problem that i have is with the cells that have a date in them ie '19/04/07. I have tried varioous methods to remove this and turn the cells into date format but to no avail.
Also i do not get the option to convert text to number
The back story is that from a system we use, when you download data from inside it, Excel treats most of the cells with a "Number Stored As Text" error. I had problems with this and it was just generally annoying so I wrote the below macro that converts each of the cells back to general cells and reinputs the data, essentially reseting the cell and keeping the data. Being that this is a loop, it takes a good while to run if alot of data was downloaded. Any idea's on how to speed it up besides screen updating? Note, other stuff happens in the first macro, but it is just cosmetic non-intensive things. It calls the second macro because I wanted them seperate should I want to just run the second.
Sub CleanData() Application. ScreenUpdating = False ' Find the Right most cell and the Bottom most cell and ' run the macro from A1 to this cell recursively Range("IV1").End(xlToLeft).Select Col = Selection.Column Range("A65536").End(xlUp).Select Row = Selection.Row Range("A2").Select Range("A1", Cells(Row, Col)).Select Application.Run ("FixTextAsNumberError") Application.ScreenUpdating = True ' End Sub..............
Public Sub add_tick_marks() Dim c As Range For Each c In Selection If Not IsError(c.Value) Then If Left(c.Value, 1) <> "'" And c.Value <> "" Then If InStr(c.Value, "E+") > 0 Then c.Value = "'" & c.Formula Else
I use these because I frequently copy billing account numbers that have leading zeros from some proprietary software and work with them in Excel. I need the leading zeros to facilitate VLookUp's. When I paste the data into Excel it truncates the leading zeros. My typical procedure is:
1. Copy a column of values from our proprietary software 2. Paste it in Excel (Ctrl+V) 3. While newly pasted data is still selected I hit Ctrl+1 which brings up the Format Cells form. 4. I double click "Text" 5. I re-paste into Excel (Ctrl+V) 6. I run my macro to add tic marks to the values so the leading zeros never get lost.
The problem occurs when I copy multiple columns of data and paste it in Excel. If one of the columns of data contains numbers or currency then I select that range of values and run the macro to get rid of the tic marks. After running the macro the numbers are still treated as text. When I select a range of those values and right-click on the status bar and select " Sum" there is no value. No big deal, I just highlight them and format the cells as numbers or currency. But after formatting them as numbers or currency, they retain their format as text until I click in the formula bar for each individual cell and hit enter, at which time they take on the number or currency format I have chosen and the sum can then be displayed in the status bar.
How can I force the formatting I chose to take effect on the data immediately without me having to individually "fake change" the data in each cell?
I have text as numbers downloaded to excel sheets from crystal that i need to add together on a summary sheet. I've tried using Value, TRIM and CLEAN functions to no avail. the TYPE function is reading the cell as Text and I have also tried multiplying by 1. Does anybody know how I can get around this ? hopefully I've attached an extract of the file
I have a file with four sheets – File1, File2, Association and LookList. File1&2 are totalled, as is Association sheet but then are checked against each other using the totals. What I need to do is the following (but I am not sure how to do it using macro…)
Step 1 - ‘File1’ Sheet – It all comes in text format. Firstly, convert all of column B=>used range (it may vary to 40k records!) into numbers and total each column. (I know the principal behind it – have a total variable for ColB, loop through and when it finds >0 then increment buy one and output under the last cell in that column – but I do not know the macro code)
Step 2 - ‘File2’ Sheet – Again, it's in text format. Firstly, convert all of column B=>used range into numbers and total each column(would contain same amount of records as Step1!) .
Step 3 - ‘Association’ – same steps as for File 1 (again – same number of records).
Step 4 - THEN (and I have NO IDEA how to do this!...) I need to check the File1 & File2 against Association using the lookup and return the Serial number and the Association heading that does not match on a fourth sheet.
The problem is that – for example – Field-1 consists total of more than one column – contains 3 but could contain a total of up to 6 columns! - I understand excel formula ‘vlookup’ but am not sure how to do it when it is a combination of columns and even less when applying it to this! – In fact, for a macro I am not even sure what column format the lookup list should be!
I immediately began having problems with formulas and pivot tables when I began importing data from an offsite postgreSQL database. For example, "countif" and "sumproduct" formulas invariably return values of 0. I can create pivot tables from the imported data, but nothing with a numerical value will group.
After fighting with this for literally hours, I finally noticed that all numbers in the columns were on the left side of the column meaning that the numerical data is being imported into Excel as text, even though the columns in the spreadsheet into which the data is imported are in number format.
Any way either to import numbers as numbers from the postgreSQL database, or to convert text to numbers after the data is imported.
I need to clean out unnecessary data from a file, (see attached text file), I'm not sure how to go about this in excel. basically every file starts with 9 cells that needs to be deleted, two cells of real data then one with garbage that needs to be deleted, it goes like that for 40 cells, then again 10 cells of garbage that needs to be deleted, then 40 of real data and goes like that up to 3000 lines, I know it sounds confusing but if you take a look at attached file, at the end I need to have all cells full of data
I have opened a .txt (by right clicking and selecting Open with rather than open from within Excel) file with numbers using the format 1,234,567.00 but in my country we use 1 234 567,00. So I created a macro changing the , into "" and the . into , and it works fine while creating the macro itself (by using the macro recorder) and the numbers shows and behaves like numbers. However, when running the macro on a new file some numbers remain as text whereas others are numbers. Theres is no common string, eg that numbers starting with - (minus) remains text.
It does then not matter if I go to the format function and select number with decimals and thousand dividor - the number still remains as text. I have also tried the suggested multply by 1 but it still remains as text. The only thing that helps is to either double click on the number or use the Konvert text to number. But I would then have to click each number in the whole table which is what I wanted to avoid.
I import data from my works server and dates are represented in text. example text format is yyyymmdd/19790310. What I'm trying to do is add and subtract from this date. I was trying to utilize formula and havent got close. I have a couple of parameters:
In column L I would like to represent the following
if column "B" is "A" add 38 years to column "J" dates are represented as TEXT if column "B" is "B" add 35 years to column "J" " if column "B" is "C" add 30 years to column "J" " if column "B" is "d" add 30 years to column "J" "
Column "M" I would like to find the difference in column "L" and "C" I know days will be difficult it can be represented in years and months only.
I have no preference on whether I use VBA or a formula but have failed on on formula and was attempting to use VBA Case method but no success. I have 10000 rows of information and am open to any ideas attached an example of my data.
In the ID column of the attached excel file whenever I convert the numbers stored as text to numbers it results in a weird transformation.
e.g. an ID of 480610141001 becomes 4.8061E+11. When I do the same process in the name column, which has similar numbers, it will give the correct result following the same process.
I have been looking through the forums and found the below code, but I have both text and numbers in the same range. I have attached an example of what I need to have converted.
See attached file. A colleague is downloading rows of data from a website which contains a number field Excel is currently treating as Text after being pasted in. My spreadsheet includes just a sample of the many rows of data however as you can see the VALUE function refuses to convert these text values to numbers. How these might be converted and why the VALUE function refuses to work in this case?
In C1, I need a formula that displays TRUE if any of the 4 numbers from A1 through A4 are contained within the text in B1. If not, FALSE will be displayed.
Been messing with SEARCH and FIND, but not getting it to work.... not sure if those are the functions I need.
I import date information in text format and need to add to the date. My date info in in column "J" and in Column "K" I would desire to write a formula that allows me to to the following. My data looks like this in text: yyyymmdd
I desire to look in column "E" and I have 3 different variables. "J", "K", "L". If column "E" has a j add 30 to the years; K add 35 years and L add 38 years. for Example: 19630923 j = 19930923 k = 19980923 L = 20010923
I have some dates in text fomat on a worksheet that I need to convert them to true dates(Value). Here some sample of the text dates: '12/31/2011; Blank space12/31/2011.
Sub CnvtTextDate() For Each Rng In Selection Cells.Replace What:=" ", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False Cells.Replace What:=",", Replacement:="", LookAt:=xlPart, SearchOrder:= _
I have a worksheet where I have around 300 rows, each with 7 columns. What I want to do is add a checkbox to each column. I plan on setting non-applicable checkboxes to mixed status and locking the worksheet. I will unlock applicable checkboxes and sumif or countif their value according to row-based scoring, for example, each checked checkbox represents a value of 3. I do not know VBA and have chose to use the form control checkboxes rather than ActiveX.
I believe that a formula for this would be something like: =SUMIF(B1:B3,True,"3") or =COUNTIF($B$1:$B$3,True)*3
I am wondering firstly if I have that right and secondly if there is a way to stop my checkboxes from displaying labels. Currently, if I click on one it displays True behind the active checkbox. If I uncheck it, it displays False.
Working with an inherited spreadsheet which has massive amounts of numbers formatted $US to 2 decimals. Can't manipulate the data: all formulas to sum groups of the numbers yield zero and formulas to multiply or divide them yield "#VALUE" error message. I guess the data is text (is left justified) although there's no apostrophe visible in the formula bar. Anybody know how I can convert these to numbers?
In cell F39 i have a number (for example) 4322.08 and i would like to convert into into text in the following way In cell B47 I would like it to say Four In cell C47 I would like it to say Three In cell E47 I would like it to say Two In cell G47 I would like it to say Two In cell I47 I would like it to say Two in cell J47 I would like it to say Eight
But essentially any number that I type into cell F39, I would like it to convert the number to text
I have the following macro that I use to convert numbers stored as text to text. For some reason, if I try to use it twice in a row, it won't work, I get an error that says "application-defined or object-defined error" and highlights this part of the Cells.SpecialCells(xlCellTypeLastCell).Offset(1, 1).Copy
I have a column that contains 4 digit numbers that I want to convert to a text value. Here is my example
Number Text Value 7004 RBPA 7002 DCVA 7001 PVBA .....etc.
There is a total of 10 different number values. I want to include the conversion vba into an existing macro that is performing other functions on the spreadsheet.
I am extracting a large set of numbers forming various tables from SAP. These numbers are not recognized as numbers and have Formula error. Only way to further process them is to convert them to number using 'Error Checking' option from 'Formula' Tab.
I need a macro to convert all such text to numbers, note there are no other formula errors.
I have other macro to delete rows, columns, take sum and create new Summary Table from the data but that does not work until I manually convert text to numbers.
how to have the macro globally i.e, I need to only open the extracted data in excel and be able to run the Macros. Presently I open the extracted data and also open the master macro-enabled file to access the macro.
I am attempting to automate a daily extract for account transactions. This extract ranges from 100 - 15000 lines on any given day. Below is an example of my data:
Account Action to be taken 8523 Needs to be converted to a number 84A2 No action needed 8523 Needs to be converted to a number 0749 Needs to remain as text stored as a number 2GP1 No action needed 8181 Needs to be converted to a number 0489 Needs to remain as text stored as a number
[code]...
As you can see, I have three types of data:
1) accounts with leading zeros which need to be stored as text
2) accounts with mixed formats which can remain as text
3) accounts that are purely numerical without leading zeros. I need to convert these from text to numbers.
Since the extract can be up to 15000 lines long, going through the data to manually convert the appropriate cells from text to numbers is unreasonable, especially when this has to be done daily.
Is it possible to script this task? I've tried a number of things, but unfortunately my knowledge of VB isn't very extensive. This is the best that I've come up with:
Code: LastRow = Range("a" & Rows.Count).End(xlUp).Row For i = LastRow To 1 Step -1 If Cells(i, "a").Value "0*" Then Cells(i, "a").Format.General End If Next
To input high volumes of dates I change the number format of cells to "00/00/00" so I can key mm/dd/yy without having to hit the slash key. In order to convert these values into an actual date, I've been using the =TEXT function because it allows me to format the text as "00-00-00" which preserves the numbers but inserts a hyphen between each set. From there I use text to columns to break each pair into its own column, and use the =DATE function to combine all 3 into a date.
Is there a way to automate this conversion process in VBA? Alternatively, I'd be open to a different method to input dates in the mm/dd/yy format without having to press the slash key.