Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can in Excel sort multiple collumns with data?

Column B = Subscribe date Column A = Subscribe name

I have multiple columns with a lot of doubles names (A) and different subscribe dates(B) How can this be sorted that all names are sorted, but the highest subscribe date is flagged as HIGHEST in column C. In this way you can see directly wich is the highest date.

share|improve this question

migrated from Aug 19 '09 at 0:54

This question came from our site for professional and enthusiast programmers.

up vote 5 down vote accepted


Here's a bit of magic using an array formula. This type of formula require you to press Ctrl+Shift+Enter, when entering the formula into a cell (notice the {}-brackets surrounding the formula in the screenshot when doing this). In other words - type in the formula, and the press Ctrl+Shift+Enter instead of just Enter.

Use the following formula in column C to mark the highest dates within a group in column A:

=IF($B2=MAX(IF($A$2:$A$100=$A2;$B$2:$B$100; 0));"HIGHEST";"")

The result being:

alt text

Note that the formula only handles the first 100 rows. You can change this easily if needed, though. E.g.:

=IF($B2=MAX(IF($A$2:$A$65000=$A2;$B$2:$B$65000; 0));"HIGHEST";"")

This formula will handle the first 65.000 rows.

Download example file here (download link valid until aug 24 2009).

Original answer

You could put the following formula in the C column:


The result being:

alt text

share|improve this answer
I'm sorry for not being clear enough. The sorting is allmost ok Bernhof, the only thing it needs to do is pick the highest subscribe date(column B) from multiple double subscribe names (A) So there can be in column A 3 x John Doe (A) and for example 4 x Mary Apple with different Subscribe dates (B) The output in C should be a flag with Highest behind the highest subscribe date with each person. – Chris Aug 18 '09 at 13:05
Chris, I've updated my answer with a formula that does the job. – Bernhof Aug 18 '09 at 13:43
@ Bernhof, That is just what I need, strangly enough, it doesn't work for me. I see #NAME? as answer. I'm a bit lost, I'm working on Excel 2007 – Chris Aug 18 '09 at 14:15
Are you using a non-english version of Excel 2007? The functions referred to in the formula might have different names in your version of Excel. I've added a link to an example file in the post, where you should be able to read the names of the formulas when you open the file in your version of Excel. – Bernhof Aug 18 '09 at 14:29
@ Bernhof, I still don't understand why it didn't work, but after I paste the data in your excel sheet it worked. Thank you! – Chris Aug 18 '09 at 14:52

Select all the data first (if there's a lot, go the the first cell and press Ctrl-Shift-Down to quickly select the whole list). From the menus choose Data -> Sort. This will give you the option of which column to sort by first (column A in your case) and second (column B).

(EDIT: The instructions below assume that you want the highest date flagged for each unique name. For the highest overall, see Bernhof's answer.)

If you sort this way, then the latest date is just the last one for that particular name. You can show the flag using this formula in C1:


Then just select the cell containing the formula, and use your mouse to drag the small handle (in the bottom right-hand corner of the cell) down to copy the formula do the other cells in column C.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .