I am trying to custom format/modify a number in excel and want to restrict the decimal to allow only ones and tens digits THEN a decimal followed by the remainder of the number. For example, the number 32248558 should be displayed as 32.248558, and the next number in sequence would go from 32186449 to 32.186449.
This would need to be done for the entire column of data.
Assuming the data is starting in A1, use TEXT() to format data. TEXT() can format using predefined settings (ex: "general") or heavily customized (ex: "MMM/DD/YYYY H:m:s"). More info can be found here: https://www.ablebits.com/office-addins-blog/2017/01/11/excel-text-function-formula-examples/
=TEXT(A1/1000000,"0.000000")
then drag this to the end of your dataset.
Related
PROBLEM:
hey y'all, i have a large dataset of both domestic and international phone numbers formatted in various ways that i need to convert to a particular format based on specific criteria.
example of current phone number formats in the dataset:
###-##-##-####-####
+##-##-####-####
(###) ###-####
+## (#) ## ### ## ##
##-##-######-#
as you can see, the phone number formats vary greatly and there are many more examples that i did not list. i work with datasets averaging 1000+ rows.
what i try varies depending on how much data cleanup i need to perform, but below are some of my current methods.
Approach 1: Manually editing
i have attempted manually updating the phone numbers to my desired formatting. however this is time consuming and leads to user error.
Approach 2: CTRL+1 "Format Cells"
i start by sorting my list of numbers. then follow ctrl+1 > Number > Custom to format the following:
domestic as 000-000-0000, UK as +##-##-####-####, etc.
the issue with this method is that the numbers are stored as formatted "Custom" values. so any special spaces or characters (i.e. "-", "+") do not exist within the string. meaning that i cannot import into my crm.
i have attempted to manually add "'" at the beginning of each formatted phone number, but it removes the special formatting. e.g. ###-###-#### just becomes '##########.
Approach 3: Functions
i have tried using the following functions on domestic phone numbers, but they only work if formatting follows ###-###-####. which is not always the case for the data i work with.
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"(",""),")","")," ",""),"-","")
or
=MID(A1,2,3)&MID(A1,7,3)&RIGHT(A1,4)
Approach 4: Macro
i've attempted recording macros, but this does not work properly since the length/formatting of a cell value and size of a sheet always varies.
Approach 5: VBA script
i am currently exploring various scripts. there are a ton of examples on stackoverflow, but most presume clean data formatted as (###) ###-####. so the scripts do not work for me.
this post was helpful as a first step to removing all special characters from cells: Phone number format
but again, only applies to certain types of formatting.
DESIRED OUTCOME
i undergo this process various times a month and am hoping somebody can help me optimize my approach.
i need domestic numbers to become ###-###-#### and international phone numbers vary, but the UK would look like +##-##-####-####. i need these characters to exist within the actual string of each cell, otherwise my crm will not accept the phone numbers.
I'm not entirely sure, but maybe this gets you going:
Formula in B1:
=MAP(A1:A5,LAMBDA(x,LET(y,CONCAT(TEXTSPLIT(x,TEXTSPLIT(x,ROW(1:10)-1,,1),,1)),TEXT(--y,SWITCH(LEN(y),10,"###-###-####",12,"+##-##-####-####","0")))))
MAP(A1:A5,LAMBDA(x - Loop over a given dataset;
LET(y,CONCAT(TEXTSPLIT(x,TEXTSPLIT(x,ROW(1:10)-1,,1),,1)) - Part where each input gets cleared into just pure numeric characters;
TEXT(--y,SWITCH(LEN(y),10,"###-###-####",12,"+##-##-####-####","0"))))) - Now use SWITCH() to test against the length of the numeric input. If 10 or 12 we kind of know what format we like, the last parameter is the 'standard' format. But obviously you could start adding checks. In the samples given, you'd want to include options for length 11 and 15.
I would like to save number format with comma delimiter as default in Excel.
So number 123456.78 will always look like 123,456.78
How can I do this ?
Excel general number formatting is based on your locale. This contains a "Digit grouping symbol", filling this is will change your format accordingly.
Be aware this is not only done for Excel, but for every application on your computer, based on this format.
Home/Styles: Right click on Normal and select Modify
Change the Number style
from General either to Number + use thousands separator
or, if you want to use Scientific notation when over a certain amount, perhaps
[<100000000]#,##0.00;General
or whatever you want.
On a daily basis I need to load data to one of our systems. However Excel deletes the previous zeros in front of the contractor IDs. So i have to add THREE zeros manually. I normally use the CONCATENATE function however now the IDs are coming differently so some IDs now only need to have TWO zeros added.
example:
ID
911111
I use concatenate to make it look like:
000911111
I came up with the IF formula that detects if the ID starts with a number NINE, to concatenate TWO zeros and if not, then to add THREE zeros.
example:
=IF(LEFT(A32,1)="9",CONCATENATE("00",A32),CONCATENATE("000",A32))
Now I want to create this formula as a custom defined so I do not have to write down the formula ever time I work on the data every day.
Any suggestions I will really appreciate.
In addition to the formatting responses provided in the comments, you could use the RIGHT function to cut off the leading zeroes to the appropriate amount.
For example, assuming A1 holds a string of numbers, between 0 & 9 digits long. We can create text representing a 9 digit string, with as many leading zeroes as necessary, as follows:
=RIGHT(REPT("0",9) & A1,9)
REPT("0",9) tells Excel to repeat the character "0" 9 times. It then tacks on whatever text is in A1. Then it takes only the rightmost 9 characters of the concatenation.
I generally would recommend the Formatting options noted in those comments, unless you need the text to be 9 characters for other formula purposes.
This question already has answers here:
ultimate short custom number formatting - K, M, B, T, etc., Q, D, Googol
(3 answers)
Closed 1 year ago.
Any recipes out there for a "smart" number formatting formula that's "scale-aware," a la Rails ActionView's distance_of_time_in_words method?
I would expect to enter a number like: 1,816,724 and see 1.8M (or enter 2,394 and see 2.4K).
To format conditionally using Billions / Millions / Thousands in Google Spreadsheets or Excel, you can use:
[<999950]0.0,"K";[<999950000]0.0,,"M";0.0,,,"B"
To apply this setting in Google sheets, goto Format > Number > Custom Number Format and copy paste the above format string.
To learn more about formatting options, go to https://support.google.com/docs/answer/56470#zippy=%2Ccustom-number-formatting
Select the cells to receive a custom number format and tap Ctrl+1. When the Format Cells dialog opens, go to the Number tab and choose Custom from the list down the left side. Supply the following for the Type:,
[>999999]0.0,,\M;[>999]0.0,K;0
Note that M is a reserved character in a format mask and must be escaped with a backslash to become literal. You can also wrap it in quotes but since I use custom number formats in VBA's .NumberFormat property, I prefer the escape character to avoid having to deal with quotes within quoted strings. Your results should resemble the following:
You can simply try this one:
=IF(A1<1000,A1,IF(A1<1000000,ROUND(A1/1000,1)&"K",ROUND(A1/1000000,1)&"M"))
supposing that your number is in A1.
Basically what the title says. I need to convert cells with dollar values into a 10-digit format that will be a feed into a database program.
So, is there a way to custom format a cell so that I can point it towards a cell with $12.41 (for example), and have it automatically convert to 0000001241?
I already figured out how to get a cell to covert into 10 digit format, but for some reason it ignores the numbers after the period (the 41 cents).
Please try:
=TEXT(SUBSTITUTE(100*A1,".",""),"0000000000")