Stop excel from converting copy-pasted number/text values to date

40

5

I'm copy-pasting some data from html table into excel. But excel automatically converts some text or number values to date! When I change the format, the number is perversed, the number is something like 4112523 (excel probably interprets the cell as date and then converts to number or something like that...)

There is a trick for importing CSV files, but is there any solution when you are pasting your data directly from a web browser?

Tomas

Posted 2012-11-19T17:11:30.310

Reputation: 5 107

8The fact that any software thinks the most appropriate way to behave is to assume you want it to reformat whatever information you gave it because surely you didn't mean for it to be THAT way... with no easy and obvious way to disable it... is the single dumbest design decision and annoying thing about Excel. I should not have click through an import wizard if all I am trying to do is copy/paste from one CSV to another. The friggin thing is a number in one CSV. Why on God's green earth would I want it to paste a date? What idiot designed that? – Matt Welch – 2014-08-25T14:55:49.560

2Before pasting, format the whole sheet as text. Now, the data you paste will not be reformatted or even analyzed for you in any way! – DanO – 2014-10-22T22:00:43.287

Have you tried custom formula? – Jeremy John – 2012-11-19T17:35:38.253

Here is a similar question http://stackoverflow.com/q/13082641/1370465

– Jook – 2012-11-19T17:44:57.263

@JeremyJohn - custom formula? What do you mean? – Tomas – 2012-11-19T17:53:59.753

but the data you are pasting is not about dates, right? – None – 2012-11-19T17:54:06.200

@BrOSs - exactly – Tomas – 2012-11-19T17:55:40.653

what about a working-aroung? it can be silly but what if you paste it in notepad? – None – 2012-11-19T18:05:01.693

can you show example of data you are inserting into excel? – None – 2012-11-19T18:06:44.250

Answers

4

Try this, it worked out for me:

Data - Import external data - New web query and follow the wizard

It's so simple.

regards!

BrOSs

Posted 2012-11-19T17:11:30.310

Reputation: 825

8Why is this the accepted answer? It doesn't address copy/pasting at all. – DanO – 2014-10-22T22:01:57.503

thank you, nice tip! But it still converts the fields... – Tomas – 2012-11-19T20:09:17.340

2I have found an import option "Disable Date Recognition" that did the trick!! So this (the import) is the only way that works for me! – Tomas – 2012-11-19T20:21:33.927

Unfortunatelly, this works only when copy-pasting from a web source. If it is copy pasting from MS Access for example, this is unusable. – Tomas – 2012-11-19T20:25:02.697

1The import external data worked for me too with MS Access, you just look for the .mdb source file. Are you working with office 2007+ ? – None – 2012-11-19T21:04:11.607

Yes, but this is complicated - it is much more comfortable to mark the rows you want in Access... I have office 2003 – Tomas – 2012-11-19T23:07:20.010

27

This is definately a kluge and it's the only thing I've figured out to do. I came here looking for a more elegant solution.

I do have a slight improvement for this.

  1. Paste the data into the spreadsheet as is.
  2. Select all and format as text
  3. Paste again over what you did the first time but this time as values.

This keeps you from having to count columns and rows, etc.

If you have data you actually want to be numbers, dates, etc, it's much easier to reformat them correctly from this end than it is to do from the other. Since the numbers won't automatically convert, I used text to columns on the column, selecting "delimited" but unchecking all the delimiters. This has the same effect as going into each cell and hitting enter to get Excel to recognize it again. Ugly, but it works.

Alex Robilotto

Posted 2012-11-19T17:11:30.310

Reputation: 271

7The real trick is that the cells must be formatted to text beforehand. The first paste helps identifying which cells are going to be covered afterwards. Good advice! – None – 2014-09-07T22:32:16.500

Caution: Padded numbers, such as "00001", lose their padding. These are converted to 1 and than to "1". The original number is unrecoverable. Tibo's solution works nicely. – Oleg Melnikov – 2017-11-23T02:46:46.400

Note: Does not work from Word. Does work from Notepad. – Alan Baljeu – 2019-03-04T15:27:24.470

17

The Most simple way.

1. Copy the original Data
2. Paste to Notepad (Prefer Notepad++)
3. Change the Cell Properties to TEXT
4. Copy All from Notepad
5. Paste back to Excel.

Shiro

Posted 2012-11-19T17:11:30.310

Reputation: 619

OK, so for million cells you do it million times? – Tomas – 2014-09-12T14:04:29.973

U can select the whole column from the top. It will select all, and copy and paste to the notepad. – Shiro – 2014-09-13T03:52:39.450

1This works! you can even just start at step 3! Select the whole sheet, format as text, paste! done. – DanO – 2014-10-22T21:48:39.057

This is what I end up doing because just changing the data to text within Excel doesn’t always work, e.g. if you have some ‘text’ that happens to be a long number (product codes etc.), Excel displays it in scientific notation. – user535673 – 2016-06-10T09:43:49.910

Excel is stupid. WHY DO THEY DO THIS TO US??? However, your solution is the only one that consistently works. – theforestecologist – 2017-08-03T05:18:25.163

10

Before pasting, select column that will hold the non-date value. Right click. Select 'format cells'. Then select 'text' as the format and click OK.

Now, go ahead and paste, but paste using the 'match the destination formatting' option.

Paul Vincent Craven

Posted 2012-11-19T17:11:30.310

Reputation: 221

This does not work for me. – theforestecologist – 2017-08-03T05:29:00.440

For formatting, "Text" works and "General" doesn't work. The detail I missed. Thanks Paul. – HongPong – 2018-04-04T21:03:01.243

2

  1. Open a Blank Workbook
  2. Click on Data
  3. Click From Text
  4. Locate your CSV/txt file
  5. Click Next
  6. Choose your Delimiter
  7. Click Next
  8. Use the scroll bar to locate the column you wish to protect and click on it
  9. Select Text from the Column data format
  10. Click Finish
  11. Click OK

The data will now have been imported without the date conversion.

Sandy Spence

Posted 2012-11-19T17:11:30.310

Reputation: 21

1

Select all the cells, and change their format to Text.

Then choose Paste -> Match Destination Formatting.

Sammy Larbi

Posted 2012-11-19T17:11:30.310

Reputation: 121

1

options/Transition

transition formula evaluation - enable it

PS

and forget about already pasted and saved data. =(

EL 2002

Posted 2012-11-19T17:11:30.310

Reputation:

thanks, but this option is unchecked! – Tomas – 2012-11-19T20:11:20.587

1Great! This works! Unfortunatelly, it perverses other data... there is a date in another column in the form "01/05/1998" and it computes 0,0001001 out of it :-) :-( – Tomas – 2012-11-20T07:18:09.633

1And it should be "transition formula entry" instead.. and note that this option is per sheet.. – Tomas – 2012-11-20T07:21:31.900

1

This is a bit of a kluge, but if the data can be pasted normally (without using Paste Special) it usually works:

  1. Format all empty cells where dates will fall as text.
  2. Right-click when pasting and select "Match destination formatting."

Be careful, though, b/c if you paste numbers into the cells that you've pre-formatted, they will also be converted to text, and you'll have to use value() or such to get them back (with Excel 2013 you get a preview of where the data will go just be hovering over the Paste button, so I usually do that and then convert the columns where date-like strings will land first).

Benjamin Morris

Posted 2012-11-19T17:11:30.310

Reputation: 11

This does not work for me. – theforestecologist – 2017-08-03T05:27:36.577

0

Extension of Alex Robilotto's Answer for clipboard object not formatted as "text".

  • E.g., this works for web-based clipboard objects

The steps:

1. Paste the data into the spreadsheet as is.
2. Select all and format the cells as text
3. Paste original clipboard object again over what you did the first time
   - But this time select "Paste Special..." and select "Text".

Note: pasting as value is not an option for non-text, web-based clipboard object.

theforestecologist

Posted 2012-11-19T17:11:30.310

Reputation: 242

0

Try following options :

1) Select the cells and go to Format --> cells --> number and select Text for the selection

OR

2) While pasting it from MS word paste it using Paste Special option and select 'Values only" option in the dialog box

Ruchi

Posted 2012-11-19T17:11:30.310

Reputation: 101

1>

  • doesn't work - the number is already perversed when I change format to text. 2) doesn't work - Paste Special does not contain the standard offer, but only: HTML, text in Unicode, text. Because I'm pasting html content.
  • < – Tomas – 2012-11-19T17:57:51.053

    0

    1. In your internet browser, File/Save Page as/Save As-Webpage, Complete/"name it"
    2. Open Excel (2007), File/Open/"name it" File you saved in #1

    Jerry C

    Posted 2012-11-19T17:11:30.310

    Reputation: 1