cell format round and display 2 decimal places - excel

I have one cell formatted as Number and with 2 decimal places.
The actual number is 69.30217 so in my cell, imagine cell A1, it appears like 69.30. This is OK.
With that cell, I'm making some concatenations so if I do something like this:
"&E5&"
The number appears as 69.30217. But if I do this:
"&ROUND(E5;2)&"
The number appears as 69.3.
What can I do to display that zero? What to show 69.30

Another way is to use FIXED function, you can specify the number of decimal places but it defaults to 2 if the places aren't specified, i.e.
=FIXED(E5,2)
or just
=FIXED(E5)

Use this
&TEXT(E5;"0.00")&

Input: 0 0.1 1000
=FIXED(E5,2)
Output: 0.00 0.10 1,000.00
=TEXT(E5,"0.00")
Output: 0.00 0.10 1000.00
Note: As you can see FIXED add a coma after a thousand, where TEXT does not.

I use format, Number, 2 decimal places & tick ' use 1000 separater ', then go to 'File', 'Options', 'Advanced', scroll down to 'When calculating this workbook' and tick 'set precision as displayed'. You get an error message about losing accuracy, that's good as it means it is rounding to 2 decimal places. So much better than bothering with adding a needless ROUND function.

Related

Can't figure out why excel is rounding currency

Here is my excel table:
The cell with 8.83 = =((C8-B8)*24)-D8
*C8 = 4:50PM
*B8 = 7:30AM
*D8 = 0.50
The cell $371.00 = =(E8*B3)
Why does my total show $371.00 when B3 = $42? It should be $370.86. I don't have it set to round but for some reason it keeps on doing it.
Because, the actual result of formula =((C8-B8)*24)-D8 is 8.833333333. Due to cell formatting you are seeing 8.83. If you want result for only two digit after decimal point then use round function like-
=ROUND(((C8-B8)*24)-D8,2)
Then you will get result 370.86. Or you can directly use in resulting cell.
=ROUND(E8,2)*B3
$371 is “technically” the correct amount, mathematically. You are actually doing rounding when you are hand-calculating your cross-check, and that isn’t matching Excel’s unfounded calculation.
( 4:50pm - 7:30am ) is 9.3333333 repeating, or “9-1/3”. Divided by 24 leaves you 8.8333333 repeating, not 8.83. Excel is doing what it’s supposed to do, and 371.00 is the correct amount. If your use case calls for times to be rounded to .01 hours and no further then you’ll need to apply rounding somewhere in cell E8.

What must be changed in given formula to change feet & inches to meters for Non-Decimal numbers

The given formula works as expected for decimal numbers ie If my input is 8.3 (8 foot 3 inches) then the formula below works but it does not works for a Non-Decimal numbers.For eg:If my input is 4 only or even 4.0 then the VALUE error appears.
What changes should be made on the formula such that it works for non decimal numbers too.
=(LEFT(B5,FIND(".",B5)-1)*12+SUBSTITUTE(MID(B5,FIND(".",B5)+1,LEN(B5)),"""",""))/39.3701
If you are entering the values as numbers, and are placing a leading zero in front of the single digit inches (e.g 8.03) then a formula to convert to meters:
=CONVERT(DOLLARDE(B5,12),"ft","m")
If you are entering them as text strings (and without the " sign), you can use:
=MAX(IF((LEN(B7) - FIND(".",B7&"."))={-1,2}, CONVERT(DOLLARDE(B7,12),"ft","m")),IFERROR(CONVERT(DOLLARDE(INT(B7) &".0" & MID(B7,FIND(".",B7)+1,1),12),"ft","m"),0))
There is no method of which I am aware that you can enter 8.1 as a number and have Excel know if you mean 8 ft 1 in or 8 ft 10 in
Per Ron Rosenfeld above entering your values as 8.01 and 8.10 respectively.

Excel 2010 Formula to replace numbers

I have a list of results that may return a decimal value between 0 and 5. For business purposes I need to force Excel to replace the number as follows:
Any decimal value between 0 and 1 needs to show as the whole number 0
Any decimal value between 1 and 2 needs to show as the whole number 1
Any decimal value between 2 and 3 needs to show as the whole number 2
Any decimal value between 3 and 4 needs to show as the whole number 3
Any decimal value between 4 and 4.5needs to show as the whole number 4
Any decimal value between 4.5 and 5 needs to show the actual decimal value.
So, if the decimal value is 1.5, I want Excel to show it in the cell as 1. Or, if the decimal value is 4.5, I want excel to show it as 4.5.
I've tried using the following nested IF function (in this example the number to replaces is in cell L28):
=IF(L28>=4.5,L28,IF(L28<4.5>=4,"4",IF(L28=4,"4",IF(L28<4>=3,"3",IF(L28<2>=1,"2",IF(L28<1>=0,"0"))))))
However for some reason it works on values 4 or greater, but for anything <4 still shows 4, and I can't figure out why.
Should I be doing this in VBA instead?
Thanks in advance, and I'm hoping I explained this clearly...
This is why the FLOOR() function exists.
=IF(A1<=4.5,FLOOR(A1, 1),A1)

How to use a conditional operator in a custom number format for dates and times in Excel?

How to use a conditional operator in a custom number format for dates and times in Excel?
If I have a column of numbers, I can use a custom number format to display a singular or plural word.
Right click cell > Format Cells... > Number > Category: Custom > Type:
[=1]# "item";# "items"
> OK
For a cell containing 1, the custom number format displays "1 item".
For a cell containing 7, the custom number format displays "7 items".
Likewise, I want to do the same with time.
If I have a column of times, such as 00:01:00, 00:20:00, 00:25:00, etc., I want to display "1 minute", "20 minutes", "25 minutes", etc.
I first tried [=1][m] "minute";[m] "minutes", but it turns out that 1 means 24 hours or 1 day.
The value of 1 minute is
1 / 24 / 60 = 1 / 1440 = 0.0006944444444444444444444444...
I tried entering a fraction, but the [=1/1440] in [=1/1440][m] "minute";[m] "minutes" turns into [=1].
Unfortunately, I tried [=0.000694444444444444][m] "minute";[m] "minutes", but that does not work.
The following works, but I want to use an exact minute value.
[<=0.000694444444444445][m] "minute";[m] "minutes"
Is there a format for 1 minute that works?
Here is the documentation on the custom number format:
Create or delete a custom number format:
http://office.microsoft.com/en-us/excel-help/create-or-delete-a-custom-number-format-HA102749035.aspx
Interesting question. At first sight, trying this fraction format:
[=0 1/1440][m] "minute";[m] "minutes"
seems to work. After entering it you will see, however, that this displays the same decimal as in the post. This is ok for the current session, but saving the file and reopening reverts to the original problem again.
The issue is that values in number formats are rounded to 15 digit precision, whereas 17 digits are needed to specify the internal floating points numbers exactly. One way to see this is to try this 17 digit precision test from the immediate window:
?[0 1/1440]=0.00069444444444444444
This returns True but removing the last two 4s so there are only 15 digits of precison returns False.
Given these observations, I think the only reliable way is to enter the 15 digit interval containing the decimal value equivalent to one minute. This can be done using the following number format:
[>0.000694444444444445][m] "minutes";[>0.000694444444444444][m] "minute";[m] "minutes"
(or if seconds were included the first value could be replace by the 2 minute value i.e. 0.00138888888888888)
An alternative method is to use conditional formatting which would probably be simpler. First apply the default number format [m] "minutes" to the cell. Then from the ribbon select Conditional Formatting > New Rule > Use a Formula... with the options: Formula...: =MINUTE(A1)=1 NumberFormat: [m] "minute"

Excel VBA stop Auto Rounding

I have price column in which the prices are displayed in 3 decimals and 4 decimals places, for example 123.456 or 123.4357.
So irrespective of the number of decimal places i want the value to be with only two decimals.
So i am selecting the column and in the VBA i am using Selection.NumberFormat = "0.00"
Which is resulting me the rounded value i.e when i format 123.456 and 123.4357 to 0.00 i am getting 123.46 and 123.44 but i want it to be 123.46 and 123.43.
So just wondering is there a way we can just trim the values instead of rounding.
Please give me some sample examples.
Thank you in advance.
Excel has a built-in function, trunc, that should do the trick for you.
This is what I placed in a1:b2.
123.456 =trunc(A1,2)
123.4357 =trunc(A2,2)
This will display
123.456 123.45
123.4357 123.43
You could treat the result as a string and extract the number of characters you need as in:
dim a as double
dim s as string
a = 123.4357
s = MID(a,1,FIND(".",a))&MID(a,FIND(".",a)+1,2)
I don't believe there is a built in mask that will truncate without rounding, you could instead use another column containing =TRUNC(A1, 2).

Resources