Lookup Based on Criteria

Amosbroker

New Member
Joined
Mar 26, 2018
Messages
32
Hello everyone!

I'm not sure if I am just having a moment or what but cant seem to figure out how to pull in some data. I have workbook with two tabs. The first tab contains Member ID information. The second tab contains multiple diseases and episodes along with the member ID. Basically I am telling Excel - If B2 on second tab = Diabetes, then match corresponding Member ID with cell in B1 on first tab and pull in the severity level to be displayed on first tab.

First tab - Member ID and Disease, wanting severity level pulled on form second tab
Second Tab - Multiple disease listed with cooresponding severity levels

First Tab:
[TABLE="width: 323"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Member ID[/TD]
[TD]Severity Level [/TD]
[/TR]
[TR]
[TD]ABC1234[/TD]
[TD]Want to pull in from second tab based on specific disease[/TD]
[/TR]
[TR]
[TD]ABC1246[/TD]
[TD]Want to pull in from second tab based on specific disease[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Member ID

Second Tab:
[TABLE="width: 507"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Member ID[/TD]
[TD]Long Description[/TD]
[TD]Major Practice Category[/TD]
[TD]Severity Level[/TD]
[/TR]
[TR]
[TD]ABC1234[/TD]
[TD]Diabetes[/TD]
[TD]Endocrinology[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]ABC1246[/TD]
[TD]Diabetes[/TD]
[TD]Endocrinology[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]ABC1247[/TD]
[TD]Diabetes[/TD]
[TD]Endocrinology[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]ABC1248[/TD]
[TD]Diabetes[/TD]
[TD]Endocrinology[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]ABC1249[/TD]
[TD]Diabetes[/TD]
[TD]Endocrinology[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]ABC1250[/TD]
[TD]Diabetes[/TD]
[TD]Endocrinology[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]ABC1251[/TD]
[TD]Other metabolic disorders[/TD]
[TD]Endocrinology[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]ABC1259[/TD]
[TD]Other metabolic disorders[/TD]
[TD]Endocrinology[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]ABC1257[/TD]
[TD]Other metabolic disorders[/TD]
[TD]Endocrinology[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]ABC1258[/TD]
[TD]Cerebral vascular disease[/TD]
[TD]Neurology[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]ABC1259[/TD]
[TD]Cerebral vascular disease[/TD]
[TD]Neurology[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]ABC1260[/TD]
[TD]Cerebral vascular disease[/TD]
[TD]Neurology[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]ABC1261[/TD]
[TD]Cerebral vascular disease[/TD]
[TD]Neurology[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]ABC1259[/TD]
[TD]Brain trauma[/TD]
[TD]Neurology[/TD]
[TD="align: right"]4[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi,

Array formula to be confirmed by CSE:


Book1
ABCD
1Member IDDescriptionSeverity Level
2ABC1234Diabetes33
3ABC1246Diabetes33
4ABC9999Diabetes
5ABC1259Brain trauma4
6
7Array formulaArray formula
8Description hard-codedDescription cell-referenced
Sheet149
Cell Formulas
RangeFormula
C2{=IFERROR(INDEX(Sheet153!D$2:D$15,MATCH(A2&"Diabetes",Sheet153!A$2:A$15&Sheet153!B$2:B$15,0)),"")}
D2{=IFERROR(INDEX(Sheet153!D$2:D$15,MATCH(A2&B2,Sheet153!A$2:A$15&Sheet153!B$2:B$15,0)),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.



Book1
ABCD
1Member IDLong DescriptionMajor Practice CategorySeverity Level
2ABC1234DiabetesEndocrinology3
3ABC1246DiabetesEndocrinology3
4ABC1247DiabetesEndocrinology3
5ABC1248DiabetesEndocrinology4
6ABC1249DiabetesEndocrinology3
7ABC1250DiabetesEndocrinology4
8ABC1251Other metabolic disordersEndocrinology4
9ABC1259Other metabolic disordersEndocrinology4
10ABC1257Other metabolic disordersEndocrinology3
11ABC1258Cerebral vascular diseaseNeurology3
12ABC1259Cerebral vascular diseaseNeurology4
13ABC1260Cerebral vascular diseaseNeurology4
14ABC1261Cerebral vascular diseaseNeurology4
15ABC1259Brain traumaNeurology4
Sheet153


Change cell references/range and sheet name to match yours.

If your "second tab" data are never repeated, there are a couple of Non-array options.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,203
Members
452,617
Latest member
Narendra Babu D

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