Vlookup mathing

niko1823

New Member
Joined
Dec 12, 2017
Messages
6
[TABLE="width: 500"]
<tbody>[TR]
[TD]dos
[/TD]
[TD]id
[/TD]
[TD]dep?
[/TD]
[TD]id
[/TD]
[TD]begin
[/TD]
[TD]end
[/TD]
[TD]dept
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3/22/2018
[/TD]
[TD]1234
[/TD]
[TD][/TD]
[TD]1234
[/TD]
[TD]4/13/2018
[/TD]
[TD]12/31/9999
[/TD]
[TD]205
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4/6/2018
[/TD]
[TD]1234
[/TD]
[TD][/TD]
[TD]1234
[/TD]
[TD]3/1/2018
[/TD]
[TD]4/12/2018
[/TD]
[TD]105
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4/25/2018
[/TD]
[TD]1222
[/TD]
[TD][/TD]
[TD]1222
[/TD]
[TD]1/31/2018
[/TD]
[TD]7/31/2017
[/TD]
[TD]106
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I have the following. I'm trying to get the dept? a member was in on the dos (date of service). vlookup on its own will not work because it will always return the first match of the id.
in the above example id 1234 dos 3/22/2018 was in dept 105 because 3/22 falls within the begin range 3/1-4/12.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
How about


Excel 2013/2016
ABCDEFG
1dosiddep?idbeginenddept
222/03/20181234105123413/04/201831/12/9999205
304/06/20181234205123401/03/201812/04/2018105
425/03/20181222106122231/01/201831/07/2018106
Sheet2
Cell Formulas
RangeFormula
C2{=INDEX($G$2:$G$4,MATCH(1,(A2>=E$2:E$4)*(A2<=F$2:F$4)*(B2=D$2:D$4),0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

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