Khang Phan
Khang Phan

Reputation: 1

VBA Excel - how to get specific value from multiple duplicated row

the question may feels confusing but please let me explain.

I have an excel sheet with 4000 rows and there are many duplicate rows like below:

Name--------------Grade

Micheal --------------       A

Sarah   ----------------       A

Oliver    ----------------     B

Micheal  --------------      C

Velvet    ----------------     A

Micheal  --------------      D

I am currently using Application.WorksheetFunction.Vlookup() to get Grade of Micheal but seems that i can only get A from it.

Is there a way to for me to choose which Grade i want to get from Micheal ?

example: C, and if C does not exists i will get D, using VBA in excel.

Upvotes: 0

Views: 38

Answers (1)

Digvijay
Digvijay

Reputation: 406

If what you want is grades in this order D>C>B>A then sort the grades.

Press ctrl + shift + L

then sort column B from Z to A.

Use Vlookup after this. You'll get grades in reverse order.

Upvotes: 1

Related Questions