Assign a rank using 2 columns

MikeGeno

Board Regular
Joined
Apr 4, 2008
Messages
130
I am working on some inventory data in which I have account numbers and scan dates. I would like to pivot the data and be able to determine which is the latest date for each account. In the example below hospital 1234 has 2 scan dates, 20110101 and 20110505. I would like to flag the 20110505 Date with a rank or some kind of indicator that shows it is the most recent date. Would like to do this for each hospital.



Column A Column B Column C
Acct Scan Date Most Recent?
1234 20110101
1234 20110101
1234 20110101
1234 20110101
1234 20110505 Y
1234 20110505
1234 20110505
6789 20110202
6789 20110202
6789 20110202
6789 20110404 Y
6789 20110404
6789 20110404
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I am working on some inventory data in which I have account numbers and scan dates. I would like to pivot the data and be able to determine which is the latest date for each account. In the example below hospital 1234 has 2 scan dates, 20110101 and 20110505. I would like to flag the 20110505 Date with a rank or some kind of indicator that shows it is the most recent date. Would like to do this for each hospital.



Column A Column B Column C
Acct Scan Date Most Recent?
1234 20110101
1234 20110101
1234 20110101
1234 20110101
1234 20110505 Y
1234 20110505
1234 20110505
6789 20110202
6789 20110202
6789 20110202
6789 20110404 Y
6789 20110404
6789 20110404
What version of Excel are you using?

Maybe this...

Book1
ABC
2123420110101_
3123420110101_
4123420110101_
5123420110101_
6123420110505Y
7123420110505_
8123420110505_
9678920110202_
10678920110202_
11678920110202_
12678920110404Y
13678920110404_
14678920110404_
Sheet1

This array formula** entered in C2 and copied down:

=IF(AND(B2=MAX(IF(A$2:A$14=A2,B$2:B$14)),SUMPRODUCT(--(A$2:A2=A2),--(B$2:B2=B2))=1),"Y","")

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
 
Upvote 0
T. Valko, Thank you for the help!

Sorry I forgot to say I am using Excel 2007.

In my haste I forgot to show that I need the Y to carry down to all dates that are max for each account. In your example I would need to have a Y next to all 20110505 dates so when I use the page by on field on Y I will get all the data from May 5th.
 
Upvote 0
T. Valko, Thank you for the help!

Sorry I forgot to say I am using Excel 2007.

In my haste I forgot to show that I need the Y to carry down to all dates that are max for each account. In your example I would need to have a Y next to all 20110505 dates so when I use the page by on field on Y I will get all the data from May 5th.
That makes it easier.

Book1
ABC
2123420110101_
3123420110101_
4123420110101_
5123420110101_
6123420110505Y
7123420110505Y
8123420110505Y
9678920110202_
10678920110202_
11678920110202_
12678920110404Y
13678920110404Y
14678920110404Y
Sheet1

Array formula** entered in C2 and copied down:

=IF(B2=MAX(IF(A$2:A$14=A2,B$2:B$14)),"Y","")

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
 
Upvote 0
Or, in C2 this non-array formula :

=IF(B2=LOOKUP(2,1/(A$2:A$1000=A2),B$2:B$1000),"Y","")

Regards
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top