I've got a .xls file with a column of zip codes.
Since they are all 5 digit numbers, Open Office Calc is treating them as numbers. I want it to treat them as text.
I know I can do it by prepending an apostrophe to all the numeric fields. But I've got a couple dozen spreadsheets with a couple thousand zip codes.
I've tried selecting the column and doing Format - Cells - picking the Number tab and selecting Text. But that doesn't work and the Format Code is # instead of '
Is there a way to select a column of numeric data and automatically add a ' to the beginning of each field?
You could do it using VBA in a macro, which would be straightforward. Alternatively you can make a formula using BAHTTEXT (under text) which converts numbers to text. If that doesn't work you can use CONCATENATE and have a column of all apostrophes, and just join those two columns. Then just drag down the formula and you will have a new column of text.
Related
Link To Spreadsheet
Sheet!1Name - Names are in Single Column
Sheet!2Names - Names are in First Name, Last Name columns.
What I'm trying to do is basically remove any suffixes, special characters, and spaces, capitalize that information, and combine it with information from another field.
I was able to figure out how to piece together some regex that seems to effectively get rid of suffixes and removes special characters. It's below. That's where my skill set stops.
={"PlayerKey";ARRAYFORMULA(UPPER(IF(ISBLANK(C2:C8),,PROPER(TRIM(REGEXREPLACE(C2:C8," Jr\.$| J$| Sr\.$| S$|IV$|III$|II$|\.|-|'",""))))))}
I'm having trouble nesting formulas - i believe what i need to do is nest both concat and substitute but not sure if that's the method to get the "Desired Output example" that is in the sheet. I'm also having trouble understanding what order to do things, which is why i'm having trouble with 2Name i think.
How's this in A1 of the new tab called MK.Help?
=ARRAYFORMULA({"Player Key";UPPER(TRIM(REGEXREPLACE(IF(MID(C2:C8,2,1)=".",INDEX(SPLIT(C2:C8," "),,1),LEFT(C2:C8))&D2:D8," Jr\.$| J$| Sr\.$| S$|IV$|III$|II$|\.|-|'",""))&E2:E8)})
I have a google spreadsheet that I am using as a quiz. The quiz takers select an option from a data validation drop down.
The cell below strips all but the first character =left(A2,1) which is a numeral value. Further below in the sheet is a cell that sums certain cells, For instance,
=Sum(A3,D3)
For some reason, the sum function does not recognize the cell as a purely numeral value, even with changing the format to number. Any ideas?
you can use SUMPRODUCT instead of SUM which is able to recognize numeric values even if they are disguised as a text string:
=SUMPRODUCT(A3:D3)
another way would be use regex like:
=ARRAYFORMULA(REGEXEXTRAXT(A3:D3, "(\d+)-")*1)
Given what is immediately above the values in Row3, that row might be redundant and the total calculated as:
=ArrayFormula(sum(0+left(A2:D2)))
I'm working in a database app that allows text formulas. There is a specific formula that will convert a number to text, but I want that text to match the format written on checks
ONE-HUNDRED-FIFTY-AND-5/100
Below is an example of the formula and the result. For some reason the output on the formula is only
AND-5/100
Any tips on what I need to do to make the rest of my formula work?
"Amount number" is the field in my database that I want to convert to text.
upper(regexReplace(numberToWords(extractRegex({Amount number},^.*(?=(\\.)))),\\s+,-)) AND extractRegex({Amount number},[^.]*$)/100
Output I'm getting is only AND X/100 the first part of the formula is not showing up.
I'm working with a big excel file that has a lot of information on businesses my company works with. I just imported another large excel file and their was a difference in format. The larger file we already have has the address, state and zip code in separate columns each spaced two apart like so:
I didn't make this spreadsheet or else I wouldn't have put the columns like that, but thats how the lady that works with it likes it.
The problem is that the sheet I imported has the city, state, and zip info all in the same cell like this:
Trollville, NY 12345
I have already over the states since 99% of the new ones were all the same state which a quick find and replace all worked. I'm now left with this
Trollville 12345
I want to move that zip code four columns to the right into the proper cell. I wrote a basic regex but don't know much about excel-vba since I haven't used it in years, but this is what I've come up with. I just don't know how to tell vba to print output the matches (which I made into an array) into the appropriate column. This is what I have so far:
Function findZipCode(zipCode)
Dim regEx As New VBScript_RegExp_55.RegExp
Dim matches, s
regEx.Pattern = "\s\d{5}\W"
regEx.Global = True
s = ""
If regEx.Test(zipCode) Then
Set matches = regEx.Execute(zipCode)
For Each Match In matches
s = s & Match.Value
Next
findZipCode = s
Else
findZipCode = ""
End If
End Function
What do I need to add? I'm open to alternative methods too if there is an easier way to do this.
Thanks in advance for the advice
Can you use the in-built Excel Worksheet Functions?
Place this in target column =RIGHT(A2,5) would capture the rightmost 5 characters of your string iff they are numeric. This will work if all of your values data values have a 5-digit zip codes at the end.
Alternatively, you could wrap it with a conditional such as IF(ISNUMBER(VALUE(RIGHT(A2,5))),RIGHT(A2,5),""), whcih would add a layer of validation to the process.
Also, did you know there is an option that may do this for you automatically if your data is comma (or space) delimited Data ribbon->Text to columns
I am looking to convert a scientific notation number into the full integer number.
E.g:
8.18234E+11 => 818234011668
Excel reformatted all my upc codes within a csv and this solution is not working for me.
I have my csv open in Notepad++ and would love to do this using a regex find and replace.
Thanks.
The damage is already done and cannot be recovered from the CSV file. 8.18234E+11 could be anything* from 818233500000 to 818234499999.
To prevent Excel from rounding large numbers, you need to store them as text. If you set the cell format to text, any value inserted from then on should be automatically interpreted as text. In OpenOffice Calc (I don't have MS Excel), you can also prefix a numeric value with ' to get it interpreted as text no matter the cell format.
There is a chance that the correct value is stored in the original XLS (or XSLX or ODS or the live Excel session or ...) file. If not, then you'll have to enter the data again. If the data is there, you need to store it as text or increase the number of significant digits in the exported CSV. If you only have the exported data, then you're out of luck.
*UPC has a single check digit, so only 100 000 out of the 1 000 000 codes are actually valid UPC codes.