Index Match question I think

TyeReece

Board Regular
Joined
Aug 3, 2007
Messages
136
I have two worksheets. Table 1 is of unique records. Table 2 is a table of conditions that may or may not match up with a unique record. Look like this:
Table 1
ID Attention Deficit PTSD Bipolar Schizophrenia
1
2
3
4
5

Table 2
ID Diagnosis
1 Attention Deficit
1 PTSD
3 Bipolar
4 PTSD
4 Bipolar
4 Schizophrenia
5 Attention Deficit
5 Bipolar

What I want to do is put a "true" or the Diagnosis name from Table 2 in column 2 of Table 1, if there is a record that matches the ID in Column A Row 2 of Table 1 and matches the diagnosis in Cell B2 of Table 1. The formula I am using (=IF($A2<>"",VLOOKUP($A2,'All Dx During Tx'!$A$2:$B$2021,MATCH(DJ$1,Columns,0),FALSE),"")) returns IF there is a matching ID but does not specify the diagnosis. Thanks in advance.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Marcelo Branco

MrExcel MVP
Joined
Aug 23, 2010
Messages
17,035
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Try something like this


A
B
C
D
E
F
G
H
1
ID​
Attention Deficit​
PTSD​
Bipolar​
Schizophrenia​
ID​
Diagnosis​
2
1​
x​
x​
1​
Attention Deficit​
3
2​
1​
PTSD​
4
3​
x​
3​
Bipolar​
5
4​
x​
x​
x​
4​
PTSD​
6
5​
x​
x​
4​
Bipolar​
7
4​
Schizophrenia​
8
5​
Attention Deficit​
9
5​
Bipolar​
10

Formula in B2 copied across and down
=IF(COUNTIFS($G:$G,$A2,$H:$H,B$1),"x","")

Hope this helps

M.
 

TyeReece

Board Regular
Joined
Aug 3, 2007
Messages
136
That is it! Looks like I was trying to make it harder than it had to be. Thanks!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,632
Messages
5,838,470
Members
430,549
Latest member
jayjay2022

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
Top