Index/Match for multiple fields, one of which is range?

shellp

Board Regular
Joined
Jul 7, 2010
Messages
199
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
I have two worksheets. One includes the patient ID and surgery date and the other has all dates for that patient ID but doesn't have surgery date, only admit and discharge date (so the surgery date is within this range). I wish to extract the visit ID for worksheet 1 from worksheet. I am familiar with vlookup but not match/index (assuming that is what is required here). Thank you for any assistance.

1682358111973.png


1682358152493.png

1682358161414.png
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
try this:
Book1
ABCDEFGHIJKLM
1Patient IDSurgery DatePatient IDVisit IDStart DateEnd DatePatient IDSurgery DateVisit ID
21114/1/20221116661/1/20221/15/20221114/1/2022777
32225/3/20221117773/29/20224/18/20222225/3/2022898
43335/15/20221118887/1/20227/4/20223335/15/2022234
52229993/1/20223/3/2022
62226764/1/20224/15/2022
72228985/1/20225/3/2022
83332345/12/20225/16/2022
Sheet1
Cell Formulas
RangeFormula
L2:L4L2=VLOOKUP(K2,$A$2:$B$4,2,FALSE)
M2:M4M2=IFERROR(INDEX($F$2:$F$8,MATCH(1,(K2=$E$2:$E$8)*(L2>=$G$2:$G$8)*(L2<=$H$2:$H$8),0)),"")
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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