MS Excel custom formatting left to right - excel

Need help regarding excel custom format, there used to be a symbol to format from left to right.
ex.
123456789 -> format 0-0-000 -> would be 12345-6-789
I'm looking for
123456789 -> format [unknown command]0-0-000 -> would be 1-2-3456789
I just can't find them.
Need them in custom format and not in VBA for the sake of frustration can't finding it. Thanks

This should work: #-#-#######
What is important is that the number of hash keys should correspond to the length of your number -> length of, or number of characters in, 123456789 is 9, the same as the number of hash keys above.

You can use conditional formatting to achieve what you need.
Select your data (let's say it's A1-A5)
Open Conditional Formatting > New rule
Select the last type "Use a formula to determine which cells to format"
As a formula type =LEN(A1)=5
Open Format, select Custom and use 0-0-000
Confirm everything
Repeat steps 2-6 as long as you need changing formula to =LEN(A1)=6, =LEN(A1)=7... and format to 0-0-0000, 0-0-00000...

0-0-0000000 is working for 9 digits numbers but for shorter like 12345 it will be 0-0-0012345

Related

Excel: How to add a plus sign to numbers and how to copy actual value of that cell (+876345558)

I have a subscriber list with emails and phone numbers.
The row with the phone numbers are plain numbers (like 98734543).
With format > custom > "+0;-0;0"
I managed to transform the plain number into +98734543.
Ok - and now I feel stupid. (I wasn't able to google the solution... oh man)
How do I transform the value of the cell (I guess it's a formula now) into an actual value that I can copy into a new row in a way that the cell value isn't just (still) 98734543 but +98734543?
I tried Paste Value (E) but this didn't work either.
Help is very much appreciated, thanks!
In the cell you want the result: =TEXT(A1|"+0")
A1 referencing the source cell. Formatting options to the right of the pipe sign.
Depending on your version of Excel it might be a comma separator instead of pipe.
Since your source is a list without any format, this seems like a better solution: output a list with the wanted format.

Excel: Text to number

I have had some numbers read into Excel from an external program. These numbers are currently formatted as text (column J). I would like to convert these numbers from text format to number format (decimal) as shown in column K as an example. I have already tried different possibilities (e.g. using the function "Text in Columns" and "Custom Formatting") but so far it has not worked. Can anyone help me?
Another way - use Data | Text to columns. Accept the defaults and change the destination to column K:
Or click on the down arrow next to the error symbol and select Convert to Number to convert in-place.
Use value function
like this in the formula bar
=value(jn)
note: n is the row number in which your values are present
Had same problem.
=VALUE(J1) or =VALUE(J1)*1 could help
also =CONCAT("0";J1) and then remove 0 (lil complicated, but worked)

Round decimal points in excel

Hey guys I have a situation where I need to format a column to display APR(%) values in a certain way. Basically the values should be formatted like below:
Raw input Formatted value
========= ===============
0 0
0.0 0
4.4566 4.5
5.00 5
6 6
6.4 6.4
I tried creating this formula below but for some reason it doesn't round the number to 2 decimal places.
=INT(ROUND(A1,1)*100)/100
What am I doing wrong? Or is there a better way to handle this?
UPDATE: So I am applying the function to the same cell as the number is in. For instance the A1 cell contains 4.566 value and I applied the function to that same cell and this doesn't seem to be working for Excel. Any other ways to do this?
P.S: Im using the MS Excel for Mac
Two steps
Format the cells to Number with one decimal place
Conditionally format the cells to a Number Format of General if the value is an integer
EDIT: Since you cannot conditionally format the number format in Excel for MAC, there are several workarounds.
If you do not mind changing the actual value, add a column which you will use to display the result. Format the Column as "General", and use this formula (assuming your "real data" is in column A:
=IF(A1<>INT(A1),ROUND(A1,1),A1)
Other options that may work would include using an event-triggered macro (if that can be done in Excel for Mac); and possibly you can create the worksheet in Excel for Windows and the conditional format might be recognized in Excel for Mac, even if you can't create it there.
As explained in the documentation here,
Suppose that cell A1 contains 823.7825.
...
=ROUND(A1,2) ... equals 823.78
You should be able to therefore apply this to your entire column to get the precision that you are after.
Rather than using =INT(<another_cell_value>*100)/100 to derive the format you want, simply specify a custom format with the following:
#,###.##
This way, you only get the number of decimal places that you specified in the ROUND function.

Data Validation In Excel to a format ###-###-###-###

Apologies if this is a common sense question, checked the web but couldn't find the exact answer I am want. I am trying to make excel only allow a number to be entered in the following format [ ###-###-###-### ] (For example, something like 102-204-304-101). I have got something similar where if I highlight a cell and go to (Format Cells -> Custom -> and in the "Type field" I enter 000"-"000"-"000"-"000. This works if somebody enters 102204304101, it will translate into 102-204-304-101. But I want another user to explicitly type the hyphens. I would guess it can be done in the "Data Validation" section under the Data Ribbon (Note I am using Excel 2010), but couldn't figure out how to do this. Would be grateful if anybody can kindly provide any tips. Thank you in advance.
Based on Excel 2007:
=AND(MID(A1,4,1)="-",MID(A1,8,1)="-",MID(A1,12,1)="-")
as a formula under Validation criteria , Allow: Custom, validates for hyphens in positions 4, 8 and 12.
Use this validation formula (replacing D11 with appropriate cell):
=IF(MID(D11;4;1)&MID(D11;8;1)&MID(D11;12;1)="---";ISNUMBER(VALUE(-0,1&MID(D11;1;3)&MID(D11;5;3)&MID(D11;9;3)&MID(D11;13;3)&1E+100)))
This ensures slashes and numbers.
You may have to change , to ; and . to , according to your local.
as each character has a definite range (0-9 and -) we can use the ASCII values of the characters to check the text. We also check the length, and, if the string is too short (producing error in the eqation, we wrap the whole thing in an IFERROR.
Building this up, we use CODE and MID to check each character:
Lower range: CODE(MID(A1, {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},1)) >= {48,48,48,45,48,48,48,45,48,48,48,45,48,48,48}
Upper Range: CODE(MID(A1, {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}, 1)) <= {57,57,57,45,57,57,57,45,57,57,57,45,57,57,57}
length: LEN(A1)=15
has to pass all tests: AND
and can't produce an error IFERROR
Putting that all together, we get:
=IFERROR(AND(LEN(A1)=15, CODE(MID(A1, {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},1)) >= {48,48,48,45,48,48,48,45,48,48,48,45,48,48,48}, CODE(MID(A1, {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}, 1)) <= {57,57,57,45,57,57,57,45,57,57,57,45,57,57,57}),FALSE)
Put this in the cell next to the place you want them to enter the code (B1 in this example), and put the validation as =B1
If the Cell is I10
DATA >> DATAVALIDATION : CUSTOM
=IF(LEN(I10)<=12;TEXT(I10;"000-000-000-000");FALSE)

Excel: Leading Zeros on Dates.. Formula to do it for me?

Is there a way to add a leading zero to a date that is 7 digits and should be 8?
7301982 should be 07301982.
I have a column full of these values, and need a way to do so with a formula. Any ideas?
I know this is an oldie, but when I googled for a solution this was the first result.
What I did was:
=concatenate(year(A1),text(month(A1),"00"),text(day(A1),"00"))
Where A1 is a date field.
=text(A1, "00000000") will do it.
Set a custom format of 00000000
Just another thought since this just happened on my new laptop. It could be your windows settings. If you prefer leading zeroes on the month everywhere in windows (like the lower right hand clock) then you can:
Control Panel >> Clock, etc >> Change Date, Time or Number Formats... then set the Short Date to MM/dd/yyyy.
This also carries over to Excel as the first date format. I know it is not a formula exactly as asked, but this is the article I found while searching.
Simply go to custom for the format of the number and select yyyy\m\d and add more m or d to it.
This is a good formula when you need leading zeros so another application sees a 9 digit number.
Add a column to your spreadsheet (Column B if your data is in Column A)
Use this formula in the new column: =REPT(0,9-LEN(A2))&A2&""
Get the 1st cell, then drag down as much as you need.
Remember to copy/paste option 123 to save as data. Otherwise, you'll see data but in reality it is a formula and you will receive reference errors if you try to use the data in column B.
9 digits and column B are variables. You can use any length or any column on your spreadsheet. Just adjust the formula.
Copied from another answer on a different site, worked for my like a charm!
ok. It seems that your dates are formatted as text. This is what you should do.
first, on a blank cell somewhere on the sheet, type the number 1. then, right click, copy.
next, highlight the entire column of dates. right click, paste special, multiply.
all of the dates will have turned into numbers.
next, highlight the date column, and apply the date format that you want.
There is a simple way to maintain the leading zeroes in Excel.
Simply add this to the cell and type whatever value you need and the zeroes will be retained
For ex: If I want 0000000023
Type into a cell '0000000023
That ' symbol seems to retain the zeroes as long as you type it before the values.
This date format MM/DD/YYYY is available if you select the Locale (location): English (Philippines). Try it with one cell and then copy/paste/special/formats the others.

Resources