INDEX-MATCH Alternative for Matrix Where COUNTIFS Works But I Need Values, Not Counts

John 314

New Member
Joined
Dec 8, 2019
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hello Folks,

I have a matrix that looks like this:

A1-NAME B1-CLASSNAME1 C1-CLASSNAME2 D1-CLASSNAME3 E1-CLASSNAME4 F1-CLASSNAME5 ... --> many columns
A2 NAME1
A3 NAME2 These cells are supposed to contain GRADES retreived from a separate dataset
A4 NAME3
...no duplicates
in this column

REFERENCE DATA COMES FROM THREE COLUMNS: 1. NAME, 2. CLASSNAME, 3. GRADE
--- There are many thousands of NAMES, hundreds of CLASSNAMES, and thousands of GRADES.
--- NAME1, NAME2...repeats for multiple classes, but each possible CLASSNAME for a given NAME can have only one GRADE

GOAL: TO PASTE A UNIQUE GRADE INTO EACH CELL WHERE: NAME1=CLASSNAME1... GRADE is positioned directly to the right of NAME and CLASSNAME in the reference dataset

NOTE: INDEX & MATCH only retreives the first occurrence of a TRUE event in each row, thus it does not work. However, COUNTIFS WORKS, but does not place GRADE in the cell, only the count.

Please help if you can. Thank you sooo much!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Welcome to the forum!
Sorry if I misunderstood.
I present 2 options.

Option 1: Sheet A has data and we fill sheet B.

Book1
ABCDE
1NAMECLASSNAME1CLASSNAME2CLASSNAME3CLASSNAME4
2Name11234
3Name25678
4Name39101112
5Name413141516
6Name517181920
7Name621222324
8Name725262728
SheetA


Book1
ABC
1NAMECLASSGRADE
2Name1CLASSNAME11
3Name2CLASSNAME26
4Name3CLASSNAME311
5Name1CLASSNAME44
6Name2CLASSNAME15
7Name3CLASSNAME210
8Name1CLASSNAME33
9Name2CLASSNAME48
10Name3CLASSNAME311
11Name8CLASSNAME4 
SheetB
Cell Formulas
RangeFormula
C2:C11C2=IFERROR(INDEX(SheetA!$B$2:$E$8,MATCH(A2,SheetA!$A$2:$A$8,0),MATCH(B2,SheetA!$B$1:$E$1,0)),"")


________________________________________________________________
Option 2: Sheet Z has data and we fill sheet Y.

Book1
ABC
1NAMECLASSGRADE
2Name1CLASSNAME11
3Name2CLASSNAME26
4Name3CLASSNAME311
5Name1CLASSNAME44
6Name2CLASSNAME15
7Name3CLASSNAME210
8Name1CLASSNAME33
9Name2CLASSNAME48
10Name3CLASSNAME311
11Name8CLASSNAME415
SheetZ


Book1
ABCDE
1NAMECLASSNAME1CLASSNAME2CLASSNAME3CLASSNAME4
2Name11 34
3Name256 8
4Name3 1011 
5Name4    
6Name5    
7Name6    
8Name7    
SheetY
Cell Formulas
RangeFormula
B2:E8B2=IFERROR(INDEX(SheetZ!$C$2:$C$11,MATCH($A2&"|"&B$1,INDEX(SheetZ!$A$2:$A$11&"|"&SheetZ!$B$2:$B$11,0),0)),"")
 
Upvote 0
Thank you so much, DanteAmor. That worked! My final formula:

‘=IFERROR(INDEX(hh!$C$2:$C$3843,MATCH($A2&"|"&B$1,INDEX(hh!$A$2:$A$3843&"|"&hh!$B$2:$B$3843,0),0)),"")

Cheers!
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,702
Members
449,048
Latest member
81jamesacct

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