If a date in a cell is between two dates in a table retrieve the right value/text

nunomd

New Member
Joined
Sep 1, 2011
Messages
16
Hi everyone,
I hope you could help me out with this question:
I would like to have the formula to insert in the cell F2, F3 and F4. If the date in cell E2 is between dates in A and B column should retrieve the right value/text in column C (to cell F2). The same for dates in cell E3, E4 and E5.
Thank you so much.

ABCDEF
1FromToPWDates
2
16/01/2015

<colgroup><col span="2"><col></colgroup><tbody>
</tbody>
15/05/2015

<tbody>
</tbody>
PW117/01/2015PW1
3
16/05/2015

<tbody>
</tbody>
31/05/2015

<tbody>
</tbody>
PW218/01/2015PW1
419/01/2015PW1
519/05/2015PW2

<tbody>
</tbody>
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
try:

F2 = OFFSET($C$1,MATCH($E2,$A$2:$A$8,1),0)

Note: Dates in column A should be in sorted in ascending order.


Hi everyone,
I hope you could help me out with this question:
I would like to have the formula to insert in the cell F2, F3 and F4. If the date in cell E2 is between dates in A and B column should retrieve the right value/text in column C (to cell F2). The same for dates in cell E3, E4 and E5.
Thank you so much.

ABCDEF
1FromToPWDates
2
16/01/2015

<tbody>
</tbody>
15/05/2015

<tbody>
</tbody>
PW117/01/2015PW1
3
16/05/2015

<tbody>
</tbody>
31/05/2015

<tbody>
</tbody>
PW218/01/2015PW1
419/01/2015PW1
519/05/2015PW2

<tbody>
</tbody>
 
Upvote 0
Assuming that your dates are in ascending sequence, and that there are no gaps between the end date in column B and the next start date on next row in column A

=INDEX($C$3:$C$6,MATCH(E3,$A$3:$A$6,1))
 
Upvote 0
Hi nunomd,

I've adjusted the ranges from the nifty main formula shown here to suit your needs as follows:

=INDEX($C$2:$C$3,SUMPRODUCT(--($E2>=$A$2:$A$3),--($E2<=$B$2:$B$3),ROW($A$1:$A$2)))

Copy and paste the above formula into cell F2 and copy down to cell F5.

Note with this formula the list does not have be sorted.

Regards,

Robert
 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,411
Members
449,081
Latest member
JAMES KECULAH

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