How do I put a formula in a Custom Number Format in Excel? For example (random example for illustration purposes),
Assume I have the following data:
INPUT
OUTPUT
Without editing the actual data in the cells, I would like to display the value in the cell divided by 2, and with two decimal places:
Is there a way to do this directly in the Custom Number Format, i.e. Without adding helper columns/cells doing the division calculation. NB. the part that has me stumped is doing the division calculation in the Number Format
Thanks!
The answer is NO, if you want to do it through custom format in a cell directly.
However, there is workaround in pivot table using calculated field option as shown below:
By the way I am curious why you want to show the number in a value other than its true value in a cell? This is not a good practice which could lead to misuse of the data in my humble opinion.
I have been wanting to display my min/60 as minutes, but the decimal is necessary for calculations. The best way I've found so far is to use conditional formatting in fractions.
0/60 "min" would display. 21666666 as 13/60 min
Which is what the cell formula was. It's only useful for around an hours worth of time, but if I come up with something to more clearly display a calculation of such as 8.5hrs as 8hrs 30min I'll update.
Related
I am trying to obtain the highest and the lowest values within a data set and record each instance. I have used the following spreadsheet to do this.
I want to obtain the lowest occurrence and if there are one or more values that are the same it will list those values too. However, when I use what I have I cant get the numbers to stop listing.
I am Assuming this is because The numbers are not the same exact values to the number of decimal places the original data comes from. e.g. the lowest value is 21.5 but the raw data gives it to 21.498 etc.
I tried using the Round function but it merely changes the formatting of the cell.
Has anyone found a way around this?
*Edit*****
I only want to report the lowest value, and if there are multiple occurrences of the same number (to one decimal place) then record those as well. The issue is that I don't know how to tell excel to stop the list if the values are the same to 1 decimal place. I tried the round function but it only changes the formatting of the cell not the actual number so excel thinks they are different values. I am not sure how to get this to work.
G3 is the top cell with =IFERROR(SMALL($C$3:$C$101,A3),"") in it.
=IFERROR(SMALL($C$3:$C$101,A3),"")
=IFERROR(IF(SMALL($C$3:$C$101,A4)=G3,"",SMALL($C$3:$C$101,A4)),"")
the data is;
And I need the highest and lowest data to 1 decimal place.
This should fix it:
G3:
=IFERROR(ROUND(SMALL($C$3:$C$101,A3);1),"")
From G4 onwards:
=IFERROR(IF(ROUND(SMALL($C$3:$C$101,A4);1)=G$3,"",ROUND(SMALL($C$3:$C$101,A4);1)),"")
You can use an Array function (entered with Ctrl+Shift+Enter):
=SMALL(ROUND($C$3:$C$20,1),A3)
And for the matching serial number:
=INDEX($B$3:$B$20,MATCH(SMALL($C$3:$C$20,A3),$C$3:$C$20,0))
Here are the results (formatted with 3 decimal places just to prove the values are properly rounded):
I have a column which has positive and negative numbers. I want to find the sum of them. All the values are in Number datatype.
When I use auto sum, I get 0.00 as my result.
Column Image
Also, the values in the column were populated from another columns (like =B2-C2)
However, if I copy and paste the values alone in another column and sum it up, I get the desired result
I agree with BigBen, it sounds like your data is in text format. Even though you change the format on the "Home" tab to "Number", it still might be read by Excel as text.
To quickly change all text "numbers" to real numbers, select the range of numbers and use the "Text to columns" feature under the "Data" tab.
Try making sure that your data is being interpreted as numbers.
For instance, use in E2 "=2*D2". You should get the corresponding number.
Do the same for all your sources cells.
(Given that you mention that these are results from calculations, I expect these to be actually numbers).
If any of the results gives you trouble, you already have the source of your problem.
If all the cells contain numbers, try using in F2 "=SUM(D2:D2)" and expanding the range one cell at a time.
You should be able to identify the source of the problem.
You may help others help you by making your workbook available somewhere online.
You don't need autosum, just SUM (which is anyway the function setup by autosum).
I'm working with some tallies and would like to manually piece together a fraction that could be read using conditional formatting.
The extracted formula that uses fractional values are as follows:
COUNTIFS(Converter!40:40,"Y",Converter!$5:$5,F$5) & " / " & COUNTIFS(Converter!40:40,"Y",Converter!$5:$5,F$5) + COUNTIFS(Converter!40:40,"N",Converter!$5:$5,F$5)
Basically, the fraction should look like a/(a+b) and I would like all tallied figures to be displayed where applicable, i.e. 2/8 or 20/100.
Unfortunately Excel is only reading this as a date, even if I use the TEXT() formula, the figures continue to be read by Excel as dates.
I'd like the conditional formatting to turn red for any figure that's short of "1".
How can I get Excel to read the figures as a fraction? Any assistance would be greatly appreciated!
You should leave formatting as a visual aspect that is displayed versus something you should control in your formulas.
What you need to do is select the cell you want to format as a fraction.
Then you select the fraction amounts that you want.
Edit: If you want to fix the denominator then you need to use a custom format.
Unfortunately I couldn't get the fractions to work as fractions, luckily what I needed it to do was trigger the conditional formatting, so I ended up using the following conditional formatting formula.
It's a little longer but got me there in the end...
=AND(RIGHT(D1,(FIND(" ",D1,1)-1))>0,LEFT(D1,(FIND(" ",D1,1)-1))=RIGHT(D1,(FIND(" ",D1,1)-1)))
I have a time sheet and I need to calculate the difference between two time values. As this sheet will be made available to all employees, I cannot make use of the 1904 date system hence I resolved to using this
=IF(A1-B1<0, "-" & TEXT(ABS(A1-B1),"hh:mm"), A1-B1)
This works and gives a negative sign to the negative values thereby overcoming the hashes ####### problem and display in Excel 2007 and higher.
Yet I cannot create conditional formatting to the result as it is obvious that the values are interpreted as text and neither can I count a group of these values with a simple summation.
Edit 1
AFAIK there is no really good way to do this in Excel. The best I have found if you want to keep the numeric time value and can't use 1904 dates is to use a custom number format like the following:
hh:mm;-[m]" mins"
This displays positive times normally and negative times as a number of minutes. So +1:45 will display as 01:45 and -1:45 will display as -105 mins. Or for consistency you could just go for:
[m]" mins"
Which formats everything as minutes.
This works because the "elapsed time" formats ([h], [m], and [s]) do handle negative times. Unfortunately you can't have more than one in a format, and [h]:mm just triggers the hash signs again.
You could use conditional formatting.
For your formula:
C1: =ABS(A1-B1)
For your Conditional Formatting formula:
=A1<B1
If you also want to have a negative sign (or parentheses) around the value, you can also go to the Number tab of the conditional formatting format dialog box, and enter an appropriate string in the positive number field.
Be careful as the values in Column C will always be positive, so do not use them in subsequent calculations. Use the original values in A1:B1 to determine whether to add or subtract
This seems to be so simple of a request, but I was not able to find an answer. I have a numeric cell and it seems to round numbers. Can I ask excel to tell me formatting settings of a particular cell. For example if the number formatting is fraction up to one digit I would like to know that. It would also be nice to know what the other attributes are; like width, centering, and so on.
You can get some information using the cell function (doc), but it's not as useful as one hopes...
You need to use VBA for more details.