Vlookup - changing array

lipstick

New Member
Joined
Oct 2, 2008
Messages
14
This is a bit embarrassing as I'm sure I've found the solution to this before, but can't remember how I did it:
Anyway, I have a table with

School a --- Subject 1 --- Score
School b --- Subject 1 --- Score
School c --- Subject 1 --- Score
School a --- Subject 2 --- Score
School d --- Subject 2 --- Score
School e --- Subject 2 --- Score
etc

I need to insert the 'score' values into another table using a vlookup. How can I do this using the School as the lookup value ONLY IF the subject matches? The table is ordered in subject order, so I could go down pasting vlookups with different arrays pointing it to only the scores and schools for that subject. But I know there's a better way of getting the array to change based on the subject number.

Thanks
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
If there is only one score per school/subject combination, you can use a formula like:

=SUMPRODUCT(--($A$1:$A$100="School a"),--($B$1:$B$100="Subject 1"),$C$1:$C$100)

The text entries "School a" and "Subject 1" can be cell references.
 
Upvote 0
Hi Lipstick,

I'm not sure you can get that done with a vlookup, but here are a couple of other options. Since you didn't mention how your data is laid out I just came up with this.

Excel Workbook
EFGH
1School aSubject 17777
2School aSubject 22121
3School bSubject 19191
4School cSubject 11010
5School dSubject 28383
6School eSubject 27676
Sheet4
 
Upvote 0

Forum statistics

Threads
1,214,858
Messages
6,121,960
Members
449,057
Latest member
FreeCricketId

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