Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel CHANGES all NUMERIC data that you enter into your worksheet!

Status
Not open for further replies.

SkipVought

Programmer
Dec 4, 2001
47,485
7
38
US
This is a reminder that Excel CHANGES all NUMERIC data that you enter into your worksheet!

I know. This is a tabloid trick! but it's true!

This is highlights & expansion from faq68-7375.

When you see the word CONVERT it means change, but in a very specific way.

When you ENTER 10 in a cell, Excel CONVERTS it to 1010 in storage but it DISPLAYS "10". Actually you're entering "10", which has a binary values of 0011 0001 0011 0000. Excel "looks" at the characters you have entered, "analyses" it and determines that you have entered a NUMBER. Then does the conversion of 0011 0001 0011 0000 to 1010. You don't need to remember all this, just that Excel changes stuff all the time and this is an oh hum.

But there is something important here. Have you ever tried to SORT a column that contained NUMBERS and TEXT? Try it some time. Excel will ask you how you want the NUMBERS sorted: A or B? It because of this: 0011 0001 0011 0000 & 1010 are not the same!

Now comes the things that can bite you.

If you enter something like 1/2, what do you think happens? the result is (in the US where month comes before day in dates) January 2 of the current year. Same with 1-2. So what's happening? Excel "looks" at the characters you have entered, "analyses" it and determines that you have entered a DATE. It parses the YEAR, MONTH & DAY and converts that into a NUMBER (the number of days since December 31, 1899) to store and displays that number in a DATE Number Format.

Now if you REALLY wanted to enter the TEXT, 1/2 or 1-2 and have Excel NOT change it, here's what you must do:
1) Change the Number Format of the cell to TEXT
2) Enter the data

If you enter the data first and then change the Number Format to TEXT, NOTHING HAPPENS! You have lost your 1/2 data! Excel has already converted it to a Date Serial Number. Of course there is UNDO, unless you turned that off.

Remember this: [highlight #FCE94F]Changing the Number Format, changes NOTHING IN THE UNDERLYING DATA![/highlight] The Number Format only affects what is displayed. It does not change the data in the cell. If you enter 1, and then change the Number Format to DATE, the DISPLAY is Jan 1 1900 but the value in the cell is still 1!

Read faq68-7375 to get the rest.

There are also two other FAQ links at the end of the blurb that you might find enlightening.
 
>Now if you REALLY wanted to enter the TEXT, 1/2 or 1-2 and have Excel NOT change it, here's what you must do:
> 1) Change the Number Format of the cell to TEXT
> 2) Enter the data

or precede the data with an apostrophe, eg:
'1/2
'1-2
 
Yes, TEXT can be entered in a cell with a Number Format of General, prefixing an apostrophe rather than changing the Number Format to TEXT before entering data the Excel interprets as NUMERIC.

This wasn't a primer on all the ways to enter TEXT. And the user prefixing an apostrophe is the user changing the entry.

My objective is centered on the fact that Excel changes numeric data and that once entered, changing a Number Format does not change the underlying data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top