How to Flip the Order of Data in an Excel Table


Q. I often recruit Excel to do double duty as a database, and there are times I’d like to reverse the order of numbers or names in a table. How can I do that?

A. In other words, you want to take a column of consecutive numbers or words, say, from 1 to 5 or Able, Baker, Charlie, and flip the order—running from 5 to 1 or alphabetizing the words in reverse order.

Excel’s Sort function can do that, but it can sort information only in columns, not in rows. Let’s reorder the sequential numbers 1 to 5. Begin by highlighting those cells. Click on Data in the toolbar and then on Sort , producing the screenshot at left.

To reverse the order, click on Descending and then on OK .

The process is different if each number is adjacent to, say, a list of names in column B, because Excel, in its wisdom, guesses that it’s possible the numbers and names are linked (see screenshot at right).

Let’s assume the numbers and names are indeed linked and you want to maintain the links—in other words, 1 is linked to Pat, 2 to Stan and so forth. Now if you highlight the numbers in column A, you will evoke this Sort Warning screen, which gives you the opportunity—by checking Expand the section —to maintain the number-name links when reordering column A.

If, on the other hand, Excel guessed wrong and you want just the numbers 1 to 5 resorted—not the names—click on Continue with the current selection .

Notice that column A is shown as the default column to sort (below center).

If you’d rather sort by B, just click on the arrow on the right until column B appears in the box at far right.

SPONSORED REPORT

How to make the most of a negotiation

Negotiators are made, not born. In this sponsored report, we cover strategies and tactics to help you head into 2017 ready to take on business deals, salary discussions and more.

VIDEO

Will the Affordable Care Act be repealed?

The results of the 2016 presidential election are likely to have a big impact on federal tax policy in the coming years. Eddie Adkins, CPA, a partner in the Washington National Tax Office at Grant Thornton, discusses what parts of the ACA might survive the repeal of most of the law.

QUIZ

News quiz: Scam email plagues tax professionals—again

Even as the IRS reported on success in reducing tax return identity theft in the 2016 season, the Service also warned tax professionals about yet another email phishing scam. See how much you know about recent news with this short quiz.