I'm looking to format excel cells such that whatever number I put in is the value it displays. i.e. at the moment when typing in 0.69374767047, the value it reads as is 0.69374767. But I also have numbers like; 0.00305 which come out correctly. Is there a way to format the cell so whatever number I put will come out to the correct decimal place and also that there is no 0s on the end of the number, as I need to do things later with that. Any help would be greatly appreciated.
Actually you can do it without code, just custom cell format and put 0.,### so it will give at least an integer and any dp if needed.
e.g.
Input Output
12 12
4.305 4.305
3.2 3.2
Related
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.
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)))
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.
I want to ask a very simple and maybe for some it may sound silly.
One person told that while copying and pasting in Excel you should use Paste Special and paste formats first and then values, then it keeps any leading zeros or else they will be removed. But someone else told other way round i.e. first values and then formats. I didn't notice any change also if I pasted as it is after copying.
So please tell me if these people are true and if yes which exactly is the correct order?
Oh, the joy of Excel conversions. You have to be cautious with your different circumstances.
Time to have some fun. Try this:
In cell A1 format the data as Text and enter the value 010.
In cell A2 leave the format as general and enter as 010.
Now go to the immediate window in VBIDE and execute the following:
? Typename(Range("A1").Value)
? Typename(Range("A2").Value)
A1 is a string, and A2 is a double.
If you change the format of A1 now to General then again type:
? Typename(Range("A1").Value)
It is still string - AND it still has the leading 0 at the front!
HOWEVER: now execute the following:
range("A1").Value = range("A1").Value
Although this looks like a pointless command - its effectively updates the cell by using VBA. Excel will now do the conversion to a double!!
? Typename(Range("A1").Value)
This is now a double.
So altering the format after the data can result in different data because Excel is doing a clever conversion. But this is dependant on the cell being updated. Just changing the cell format might change that value, but not necessarily - and later it could change if a user presses F2 and enter on the cell. Lovely - thank you excel for being intelligent.
Don't even get me started with other conversions.
So, I suggest that in the majority of cases, you should actually format first and data after.
Happy pasting! :)
Cell value and cell format are two distinct properties of a cell in Excel.
For displaying values, excel applies the format of the cell to its value. So if your cell holds a number and the format specifies that the number should have leading zeros, the number will be displayed with a leading zero. This does not change the underlying value!
The format affects only the display.
As an example:
Let's say your cell holds the value 5.5 as numerical value. Applying the format 0.00 will display that value as 5.50. Applying the format 0.00 min will display the same value as 5.50 min. But the value itself is still unchanged 5.5 - this way, you can e.g. be very specific about how you want to display a number, but still use its plain value for calculations. Same principles apply to every other formatting rule and data type of course.
So no matter which way round you paste - as long as the cells end up with the correct combination of value and format, you will end up with the correct result.
I have an Excel spreadsheet with a range of values which are numbers that go to up 20 decimal places, unpivoted from another sheet using the trick from here.
The trouble is the cells are only displaying 10 digits so, for example, even though the value is 5.46827166811115 it is showing as 5.468271668.
I've tried setting the format to text but it still wants to treat it as a number, the number of decimal places varies so I can't use a fixed #.### format. The only way I can get it to show is to format the cells as text and to just select and then click in the entry box for each and every cell!
It then shows a warning that the number in the cell is formatted as text or preceded by an apostrophe but at least it's showing the full value.
I did find a VBA script that just did something stupidly simple like cell.Value = cell.Value for the selection which seemed to work but I can't find it anymore and I can't reproduce that now.
Surely there's an easier way to do this? It wouldn't matter so much but when I import this data through SSIS into a VARCHAR(MAX) it's getting the truncated values!
Pre-pend a single apostrophe ' to the data. In many cases, this is more effective than setting the cell format to text.
You could format the cell as text and the do an .AutoFit so the cell expands to show all the cell content, like this:
Columns("A:A").EntireColumn.AutoFit
that will expand the A:A cell so all its content is visible.
try formatting with #.000 instead of #.###, but if your problem is that Excel is dropping precision on you, you could try multiplying the value by 10^20, then dividing by 10^20 on the SQL side.
found more info:
here
looks like Excel is limited to 15 digits of precision, multiplying by 10^20 doesn't increase the precision, so you can treat it like text or split the remaining digits into another column and combine them back with SSIS or SQL.
Have you added the IMEX=1 to your connection string? That keeps SSIS from trying to figure out the data from the first few rows.
Also, what about using a decimal datatype instead of varchar(max)