How to make excel stop treating column as date - excel

My column values are as follows:
1-1
1-2
2-1
2-2
...
12-1
12-2
13-1
13-2
...
n-1
n-2
On cells containing 1-1 up to 12-2, excel doesn't meddle with me, but starting on 13-1 up to the nth row, it shows warning "Text date with 2-digit year". Unfortunately, this are really not dates. Also, I already tried formatting the said rows/cells as text before inputting any values, but really when excel sees "13-1" and above, it shows the error. How should I fix this?
Additional info: when the rows are shown using formula, there are no errors, but sadly, using formula is not an option and I need values as is.

You can type ="1-1" instead of just 1-1
When you type 1-1, excel change this to 1-Jan. When you type ="1-1" , Excel treat the value as string. Hope it helps.

Just right click on the column click on Format Cells ... on Number Tab on Category List select Text, this will make anything you enter or have as a text.
But if you are copy paste data then use Match Destination Format (M), just right click on the cell and select Match Destination Format (M) not Ctrl-V.

If you add a single quote to the start of the dates Excel treats it as a string. Works for numbers as text too

Stop excel from converting copy-pasted number/text values to date
Copy the original data
Paste to Notepad / Notepad++
In Excel, change the Format Cells / Number Format (that shows "General" as default) to TEXT
Copy your data from Notepad
Paste back to the Excel cells, in which you have changed the format to TEXT

Turn off error checks for those types of errors.
With Application.ErrorCheckingOptions
.TextDate = False
.NumberAsText = False
End With
Also found within File, Options, Formulas, Error checking rules.

Related

change cell format to general or text?

we have sort of data in excel like this ---> 34:5:20
excel likes to consider it as time or date.
here is the problem because I know it's not a date and what ever action I want to do with it again
excel thinks it's a date/time value .
how can I stop this behavior ?
(each of the ':' delimited values has a special meaning to me but not date/time)
thanks a lot.
There is one option though, you can use the formula below, to convert the dates back to your format
=CONCAT(" ",TEXT(A2,"[h]:mm:ss"))
I am adding a space using concat function just so that if you ever decide to convert all to value, it will not return back to dates
I found the solution finally .
copy column to notepad.
select another column
change it's format cell to text.
now paste from notepad.
now my data is considered as text and I can separate the values using "column to text" from DATA tab.
thank you all for your valuable time.

Can Not Get My VLookUp In Excel To Return The Requested Data

Can Not Get My VLookUp In Excel To Return The Requested Data
I am trying to pull data from another sheet based on data selected from a dropdown on the main sheet.
All the formatting is "General"
=VLOOKUP(F15737,'Location Master'!$A:$J,2,FALSE)
It just keeps returning me #N/A
Try using the Index Match method. It's an alternative to Vlookup which doesn't require data to be sorted and can therefore be of more use.
The typical structure of this method is (the text inside the asterisk will give the ranges specific to your sheet:
=INDEX (**Column from which you want to return a value**, (MATCH(**Lookup Value**, **Column against which you want to lookup**,0))
In this case, if I've understood your workbook structure, the formula should look like this:
=INDEX('Location Master'!$B:$B,(MATCH(F15737,'Location Master'!$A:$A,0)))
This is a common problem with VLOOKUP(). Most likely you have some whitespace (A tab character or some spaces) after one of the values. Click on F15737 and see if there are any spaces at the end of it. Likewise, manually find the value in 'Location Master'!$A and check it for spaces or tabs after the value.
If the whitespace is found in F15737 then you can change your vlookup to be:
=VLOOKUP(TRIM(F15737),'Location Master'!$A:$J,2,FALSE)
If the whitespace is in the range to which you are looking up, then you'll need to trim all of those values, which you can do pretty quickly in a new column with the TRIM() formula.
If this doesn't solve the problem then you might have a number stored as text. Generally excel will tell you if this is the case within the cell with a little green corner indicator. To get Excel to automagically change a column from a "Number stored as Text" to a proper number you can:
Highlight the column
Go to Data>>Text To Columns
Click "Fixed Width"
Click "Finished"
Excel will then format everything automatically (dates to dates, numbers to numbers, text to text, time to time, etc.)

Excel weird behaviour with dates => text

I have a ton of cells that contain dates such as 22/12/2013. This is set automatically as Date format. And if I try to change the cell format to text (Simply because I want it to be text rather than a date so that I can read it later with PHP), the thing changes completely.
Here's how to replicate the error.
Write in a cell 22/10/2013
Change the format to TEXT
The original content gets changed to 41569
I need a way to fix this, because otherwise when I read the date with PHP, it gets convereted to 41569 nonetheless. But if I manage to make it text, it will be alright.
As andy holaday says, using cell formatting to change the format won't actually change existing numbers (dates) to text. You can do that with "text to columns" functionality:
Select column of dates > Data > Text to columns > Next > Next > at step 3, under "column data format" choose "text" > Finish
That converts existing dates, if you have dates to enter which you want to enter as text you can add an apostrophe, as Polly says, or you can simply pre-format the entry column as text format.
It's not an error. Changing the format of a cell does not change the value that is stored in that cell. Excel stores dates as numerical values. What I think you want to do is change the numerical value into text that resembles a date. Try this formula in a new cell somewhere:
= TEXT(A1,"dd/mm/yyyy")
Enter your dates with an apostrophe at the beginning. '22/10/2013 will be interpreted as a text string.

Excel always change my data to date when copy a html sheet to it

I copy a sheet from html page.Because I need the sheet structure,the "paste as text" selection is no use here.
The data will be like this
2/3 3/4
1012/2332 332/665
when paste to excel
2/3/2012 3/4/2012
1012/2332 332/665
the data cannot be parsed to date form is safe while those which can will be changed and cannot be changed back in format cell.
How to disable this feature of excel,really annoying.
This is an obnoxious problem. Have you tried setting the cell format to Text before pasting as text? this works for me in 2003. I'm afraid simply doing one or the other is not enough, and the order is important.
If this works (and you need to do this frequently or regularly), you can set up a custom macro (e.g. CTRL-SHIFT-P, etc.) to set the format and do the paste all in one motion.
EDIT:
For the record, here is what the different paste methods produced for "2/3":
Paste (normal) 3-Feb
TXT Format->Paste 3-Feb
Paste->TXT Format 40942
Paste UNI 3-Feb
*TXT Format->Paste UNI 2/3
Paste UNI->TXT Format 40942
Paste TXT 3-Feb
*TXT Format->Paste TXT 2/3
Paste TXT->TXT Formar 40942
Up until recently (2/27/2013) the Excel data import of the bank account text file information handled the date field of the text file correctly. It isn't clear to me why this changed, but it lead to my looking here for a solution.
I'd like to propose to you a different solution than above...
copy the offending dates to a separate excel sheet
use the Mid function ( mid(string, start, number of chars) to extract each date component to
a separate column in the same row (Look at columns B, C, and D
in the next column use the Date function ( date(yr, month, day) to convert the date components
from the prior three columns into something excel will deign to recognize as a date (remember,
computers are basically stupid, and Microsoft programs are about the contrariest things on the
planet!)
PASTE SPECIAL the values from your date column back to your worksheet
VOILA! You have fixed a problem that you should NEVER have had in the first place.
I tried to paste the spreadsheet here (and also by hand typing, but this display collapses repeating characters. Suffice to say it looks like this...
02/27/2013 02 27 2013 02/27/2013
original mm dd yyyy value ms recognizes as a date which you can paste by value back to spreadsheet
the formulas for those not familiar with Excel...
un-date from worksheet in column at (excel sees as a string...not a number!)
for month: mid(a1,1,2) (take the thing in column a1, start at the 1st character, and grab two chars)
for day: mid(a1,4, 2) (take the same thing from column a1, grab the two chars starting at the 4th)
for year: mid(a1,7,4) ...
making it a date: you now have month in column b1, day in column c1, and year in column d1, so
in column e1 you say: date(d1, b1, c1), and then you see the same date as shown in column a1, however, this will now be recognized by Excel as a date! Copy this and PASTE SPECIAL>Value to the column in your original worksheet and it will respond.
I had looked in the original column for a ' character which denotes treat this value as text only, but I hadn't found one. I do not know why Excel has become pesky like this, but I have come to expect this type of frustrating and annoying behavior from Microsoft programs. Yes, I do still buy the darn things, but often choose open source code when I can because of these "features".
Good luck.
I just came across this problem and found a really good solution. Here are my steps:
Copy and paste so that you can work out the area to be selected.
Delete the contents of the cells
Change the formatting to TEXT
re-paste but use the paste button in the menu bar and choose 'Match Destination formatting'.
This works like a dream! :)

external data formatting strips off leading zero

I am using excel 2003 and importing an external data source from an asp page.
This page returns a table of data that populates the excel cells.
If a cell has a phone number in it, the leading zero is removed by excel, although if I look at the query in the import dialog, the zero is still there!
The cells have been formatted as "text" in the hope this would not happen, but still the text gets treated as a number!
Any ideas? I could really do with some help on this one.
Hmm, changing the NumberFormat to text should work. If you're dealing with a fixed-width cell (i.e., 10 digits for a phone number), you can manually prepend leading zeros. Assuming data is in column A, put this formula into column B
=right("000000000"&A1,10)
You can then copy and PasteSpecial into column A.
If the cells are not fixed width and If you have access to the query that populates the asp page, you can insert a temporary column that has the desired cell length and use that to modify the function.
Likewise, if you're just looking to display the information and you don't need to act on it, you can put a number mask over the cell (Format Cell->Custom->0000000000).
As for upgrading, I am currently using Excel 2007 and constantly import data with prepended zeros by making the specific column a Text field.

Resources