Change cell format but not number size? - excel

When cells are in percentage format, you may have one that is 5.97% and another 87.2%. When you change format to number you get 0.0597 and 0.872. Is there a way to change format to number but not scale? e.g 5.97% would go do 5.97? It seems simple but i can't find a way to do it in the same cell. Thanks for any help offered! :)
Edit: I know you can try things like LEFT(LEN()) or reformat and *100 but this becomes annoying if the cell values are produced by formulas.

Format - cell
In alignment untick wrap text
In number - custom type 0.00 then CTRL+j then % and you should be good!

Related

Formatting a number with decimal places

I am trying to format a price that looks like this "193.250". I want to format it to "1.93250".
I've tried playing around with the format cells, but i can't seem to figure it out.
I don't think there's a custom format that will do that, but you could put this formula in a separate column
=A1/(10^(SEARCH(".",A1,1) - 2))
Of course, that will make 100.5 look like it has a greater value than 1000.5. The other option would just be to add a formula to divide by 100 and use the "Increase/Decrease Decimal" buttons to show the desired number of digits.

Excel formatting to correct dp

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

Which is the correct way of pasting?

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.

Calculate time differences

I want to calculate time difference of a column in Excel, column data shown below:
08:06am-12:00pm
10:40am-11:30am
01:15pm-04:00pm
Please share any formula, reference or method to calculate time difference in Excel column.
This will do it:
=VALUE(MID(A1,9,5)&" "&MID(A1,14,2))-VALUE(MID(A1,1,5)&" "&MID(A1,6,2))
Apply a number format to the cell of hh:mm.
Please try:
=TEXT(LEFT(RIGHT(A2,7),5),"hh:mm")+IF(MID(A2,14,1)="p",1/2,0)-TEXT(LEFT(A2,5),"[hh]:mm")+IF(MID(A2,6,1)="p",1/2,0)-IF(RIGHT(A2,7)="12:00pm",-0.5)
It's pretty simple, actually:
=TIME(HOUR(B2),MINUTE(B2),SECOND(B2))-TIME(HOUR(C2),MINUTE(C2),SECOND(C2))
Where B2 and C2 both have times in them.
What it looks like there is that your column has BOTH times in it. You will have to split those columns first. Because the way you have it, the field will be interpreted as TEXT and nothing else.

Storing numbers are text Excel 2007

When numbers are stored as text in Excel you see this little guy http://imgur.com/zXdwD
in the upper-left hand corner. when you click on it it gives you the option of converting the text representation of a number to a number upon which math can be done. also, when stored as text numbers appear on the left side of the cell opposed to the right one. I have an array of numbers which are stored as text, but they don't offer that little green thing to convert them to numbers. It may sound trivial but I'm using the Vlookup function to reference a large column of numbers to a code name, but it's not being recognized. And the only thing I can think of is that it's somehow being read differently (the codes are most defintely in the lookup table, and ctrl+f will find them). I want to know if anyone has an idea about what's happening.
Thanks.
The smart tag is a little finicky at times. There's a couple of things you can do.
If you're using code, you can multiply the cells in the range by 1, this will convert them to a number.
Alternatively you can convert the number you're matching to a string and then vlookup. Something similar to:
=VLOOKUP(TEXT(A1,"#"),B1:D10,2,false)
Note TEXT(A1,"#") would round to no decimal places, you may have to adjust the formatting.
The format of some of the cells in the lookup table maybe formatted as text. If there are a lot of them you can create a macro that corrects them. I had the same issue in this SO question although it was the opposite problem.
Another way to correct them would be to copy all the cells in the lookup table in that column and in an adjacent blank column edit>paste special>values>add which makes each of them numeric. Then copy them and paste those back over the originating cells.
A quick trick to convert all numbers formatted as text back to umber format is to copy the data into the "Notepad" application. Then select and copy the data from "Notepad back into your spread sheet and everything will be converted to number format.

Resources