Defeating Date Parsing when Pasting Information

by Allen Wyatt
(last updated January 7, 2017)

4

Tom notes that the NFL publishes American football standings on their website at http://www.nfl.com/standings?category=league. He wants to copy these standings into an Excel worksheet. However, when he copies and then pastes them, the columns containing win-loss ratios are parsed as dates by Excel. Tom tried formatting the cells before pasting, but the act of pasting seems to override the cell format.

There are actually a few ways you can approach this need, and Tom is off to the right start—you need to format the columns consistent with the data that will be in them. Primarily, you need to format the columns that will contain the win-loss ratios (Home, Road, Conf, etc.) as Text. Then, select the information on the web page and press Ctrl+C to copy it to the Clipboard.

It is at this point that you have options. One option is to select the upper-left cell of where you want the information pasted, and then display the Paste Special dialog box. (Click the down-arrow next to the Paste tool on the Home tab of the ribbon, and then choose Paste Special from the resulting options.) (See Figure 1.)

Figure 1. The Paste Special dialog box.

In the Paste Special dialog box, choose Text and then click OK. Your information is pasted into the worksheet, and the formatting you previously applied is not affected.

Another option is to select the upper-left cell of where you want the information pasted, and then right-click that cell. Excel displays a Context menu, and there is a section in the menu entitled Paste Options. You could select Paste Special from those options and continue as previously described, but just above that option are two icons. If you hover over the right icon, you'll see what it does: Match Destination Formatting. Click on the icon, and the information is pasted without affecting any of the formatting you previously did.

A third option is to select the upper-left cell of where you want the information pasted, and then press Ctrl+V to paste whatever is in the Clipboard. The formatting will look ugly, but you should notice a Paste Options drop-down at the lower-right corner of what you just pasted. Click that drop-down and you can select the same Match Destination Formatting option previously described. The formatting of the paste area reverts to what you had before, and the worksheet cells contain the data you desire.

A fourth option is to use NotePad as an intermediary on the data you want to copy. Copy it from the web page, paste it into Notepad, copy it from Notepad, and paste it into your Excel worksheet. This process strips any formatting from the information and effectively pastes it into your worksheet as "text only," which is equivalent to the first option discussed earlier.

If you are using Excel 2010 or later you have a fifth option: You could use the Power Query add-in to grab the information from the NFL web page. This isn't exactly "pasting" information, but it does allow you to get the data into your worksheet rather painlessly. You can find more information about Power Query for Excel 2010 and Excel 2013 here:

https://support.office.com/en-us/article/Microsoft-Power-Query-for-Excel-Help-2b433a85-ddfb-420b-9cda-fe0e60b82a94

In Excel 2016 Microsoft (as they are infuriatingly apt to do) changed the name of Power Query to Get & Transform. More information about this tool can be found here:

https://support.office.com/en-us/article/Get-Transform-in-Excel-2016-881c63c6-37c5-4ca2-b616-59e18d75b4de

Either PivotQuery or Get & Transform allows you to connect to the web page and import the tabular data into your worksheet. An added advantage of using these tools is that a link is established between your worksheet and the web page so that you can easily update the information in the worksheet as desired.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3193) applies to Microsoft Excel 2007, 2010, 2013, and 2016.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Colors for Tracking Changes not Acting Properly

When the Track Changes feature is turned on, Word, by default, displays the edits made by each document editor in different ...

Discover More

Determining Picture Size in a Macro

When processing a document using a macro, you may need for your macro to figure out the sizes of the images in your document. ...

Discover More

Adding Comments to Protected Worksheets

When you protect a worksheet, Excel stops users from editing or otherwise making changes to the data in the worksheet. If you ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Displaying an Input Format in a Cell

Want to show a user, in a cell, what you expect their input to look like? Unfortuantely it cannot be done natively in Excel. ...

Discover More

Forcing Editing to Be Done in a Cell

Excel allows you to edit your cell contents in two places. What if you want to limit where editing occurs, so it can only be ...

Discover More

Changing Months in a Workbook

When you copy a worksheet and then need to make changes to information in that worksheet (such as changing month names), the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 + 4?

2017-01-09 05:04:33

DaveS

Just tried the second option, it worked fine. I think the team names aren't being split into individual words because they are hyperlinks in the source web page rather than text.


2017-01-08 10:06:09

allen@sharonparq.com

Interesting, Tom. I tested all five methods I mentioned and all five worked with the data you provided.

-Allen


2017-01-08 02:12:38

Tom Lopaka

Hi Allen,

I'm not sure that any of the suggestions were actually worked through using excel. I had no success in getting it to work properly. I did however get some ideas.

Starting, at http://www.nfl.com/standings?category=league do a copy to the clipboard of just the table. CONTROL-C.

Open Notepad and copy to it. CONTROL-V

Save as an .xls file.

Open saved file using excel.
Excel will complain.
Click Next
Click Next
Import Wizard will show output (not quite done as excel will want to mess it up)

It is here (Import Wizard 3 of 3)that you need to format the cells. The headings say General. First column is black.
Go to top left, Column data format. Note that General is selected.
NOW look for columns that will have dates ie where there is a - (dash) between two or more numbers.(Remember some games are drawn.)
There are 6 columns to change. Set these to Text.
Click Finish
Other than some minor column width editting it is done and Excel lies defeated (not quite).
Saving the file then opening seems to have lost the cell formatting....not a major problem though.

Excel is definitely NOT WYSIWYG.

You may not have fixed my problem but gave me some ideas. Wont say that it the most efficient way but it works.

Regards
Tom

PS This may be a follow up article perhaps.
Change these columns to Text.


2017-01-07 06:12:16

Alex B

I don't believe the paste special > text gives you an optimal solution.

Firstly the default Excel uses when it does Paste Special > Text is whatever the text to column setting is and this originally defaults to <TAB>.

In order to get Paste Special > text to parse the data at all you need to have done a text to column conversion setting the delimiter to <space>.
Once you have done this Excel remembers this in the current excel instance and will use this the next time you use Paste special > text.

Parsing using space still does not give you a great result since the first column has a different number of words for the club names.

Apart from Power Query which gives a very good result, you can also either click on the Home > Paste drop down or right-click and there will be 2 paste buttons. They are Keep Source Formatting & Match Destination Formatting.
The option Match Destination Formatting, will give you an excellent result.
It still requires the preformatting of the Win-Loss columns to text.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.