Excel Lookup function

Cgeisler

New Member
Joined
Sep 15, 2015
Messages
2
Hello, I am looking to derive a value based on a variable data set. I want take the date that is chosen and find that value in Column C then look to Column E's # that is chosen and give me the value from Column C that is that # (in this case 1) day prior to the Date I entered. Another kicker is that it cant be a weekend, so it would need to skip over all dates that in column D are labeled 1 or 7. For this example, the value the formula should have chosen is 1/9/15. Any ideas? Thank you:nya:

[TABLE="width: 1291"]
<colgroup><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Date:[/TD]
[TD]01/12/2015[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD][/TD]
[TD]Column C[/TD]
[TD]Column D[/TD]
[TD][/TD]
[TD]Column E[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1= Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday,7=Saturday[/TD]
[TD][/TD]
[TD]Days Prior[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Day of Week[/TD]
[TD][/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]9/7/2015[/TD]
[TD]1/1/2015[/TD]
[TD][/TD]
[TD]1/1/2015[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/12/2015[/TD]
[TD]1/2/2015[/TD]
[TD][/TD]
[TD]1/2/2015[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/11/2015[/TD]
[TD]1/3/2015[/TD]
[TD][/TD]
[TD]1/3/2015[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/26/2015[/TD]
[TD]1/4/2015[/TD]
[TD][/TD]
[TD]1/4/2015[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12/25/2015[/TD]
[TD]1/5/2015[/TD]
[TD][/TD]
[TD]1/5/2015[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/1/2016[/TD]
[TD]1/6/2015[/TD]
[TD][/TD]
[TD]1/6/2015[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/18/2016[/TD]
[TD]1/7/2015[/TD]
[TD][/TD]
[TD]1/7/2015[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2/15/2016[/TD]
[TD]1/8/2015[/TD]
[TD][/TD]
[TD]1/8/2015[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5/30/2016[/TD]
[TD]1/9/2015[/TD]
[TD][/TD]
[TD]1/9/2015[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7/4/2016[/TD]
[TD]1/10/2015[/TD]
[TD][/TD]
[TD]1/10/2015[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9/5/2016[/TD]
[TD]1/11/2015[/TD]
[TD][/TD]
[TD]1/11/2015[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/10/2016[/TD]
[TD]1/12/2015[/TD]
[TD][/TD]
[TD]1/12/2015[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/11/2016[/TD]
[TD]1/13/2015[/TD]
[TD][/TD]
[TD]1/13/2015[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/24/2016[/TD]
[TD]1/14/2015[/TD]
[TD][/TD]
[TD]1/14/2015[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12/26/2016[/TD]
[TD]1/15/2015[/TD]
[TD][/TD]
[TD]1/15/2015[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/2/2017[/TD]
[TD]1/16/2015[/TD]
[TD][/TD]
[TD]1/16/2015[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/16/2017[/TD]
[TD]1/17/2015[/TD]
[TD][/TD]
[TD]1/17/2015[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2/20/2017[/TD]
[TD]1/18/2015[/TD]
[TD][/TD]
[TD]1/18/2015[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5/29/2017[/TD]
[TD]1/19/2015[/TD]
[TD][/TD]
[TD]1/19/2015[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7/4/2017[/TD]
[TD]1/20/2015[/TD]
[TD][/TD]
[TD]1/20/2015[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9/4/2017[/TD]
[TD]1/21/2015[/TD]
[TD][/TD]
[TD]1/21/2015[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/9/2017[/TD]
[TD]1/22/2015[/TD]
[TD][/TD]
[TD]1/22/2015[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/23/2017[/TD]
[TD]1/23/2015[/TD]
[TD][/TD]
[TD]1/23/2015[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12/25/2017[/TD]
[TD]1/24/2015[/TD]
[TD][/TD]
[TD]1/24/2015[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/1/2018[/TD]
[TD]1/25/2015[/TD]
[TD][/TD]
[TD]1/25/2015[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/15/2018[/TD]
[TD]1/26/2015[/TD]
[TD][/TD]
[TD]1/26/2015[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2/19/2018[/TD]
[TD]1/27/2015[/TD]
[TD][/TD]
[TD]1/27/2015[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5/28/2018[/TD]
[TD]1/28/2015[/TD]
[TD][/TD]
[TD]1/28/2015[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7/4/2018[/TD]
[TD]1/29/2015[/TD]
[TD][/TD]
[TD]1/29/2015[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9/3/2018[/TD]
[TD]1/30/2015[/TD]
[TD][/TD]
[TD]1/30/2015[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/8/2018[/TD]
[TD]1/31/2015[/TD]
[TD][/TD]
[TD]1/31/2015[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/12/2018[/TD]
[TD]2/1/2015[/TD]
[TD][/TD]
[TD]2/1/2015[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/22/2018[/TD]
[TD]2/2/2015[/TD]
[TD][/TD]
[TD]2/2/2015[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12/25/2018[/TD]
[TD]2/3/2015[/TD]
[TD][/TD]
[TD]2/3/2015[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/1/2019[/TD]
[TD]2/4/2015[/TD]
[TD][/TD]
[TD]2/4/2015[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/21/2019[/TD]
[TD]2/5/2015[/TD]
[TD][/TD]
[TD]2/5/2015[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2/18/2019[/TD]
[TD]2/6/2015[/TD]
[TD][/TD]
[TD]2/6/2015[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5/27/2019[/TD]
[TD]2/7/2015[/TD]
[TD][/TD]
[TD]2/7/2015[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7/4/2019[/TD]
[TD]2/8/2015[/TD]
[TD][/TD]
[TD]2/8/2015[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9/2/2019[/TD]
[TD]2/9/2015[/TD]
[TD][/TD]
[TD]2/9/2015[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/14/2019[/TD]
[TD]2/10/2015[/TD]
[TD][/TD]
[TD]2/10/2015[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/11/2019[/TD]
[TD]2/11/2015[/TD]
[TD][/TD]
[TD]2/11/2015[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11/28/2019[/TD]
[TD]2/12/2015[/TD]
[TD][/TD]
[TD]2/12/2015[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12/25/2019[/TD]
[TD]2/13/2015[/TD]
[TD][/TD]
[TD]2/13/2015[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/1/2020[/TD]
[TD]2/14/2015[/TD]
[TD][/TD]
[TD]2/14/2015[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1/20/2020[/TD]
[TD]2/15/2015[/TD]
[TD][/TD]
[TD]2/15/2015[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2/17/2020[/TD]
[TD]2/16/2015[/TD]
[TD][/TD]
[TD]2/16/2015[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5/25/2020[/TD]
[TD]2/17/2015[/TD]
[TD][/TD]
[TD]2/17/2015[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi,

I could do this after adding a helper column:

You have dates in Column A, B & C. Column D contains numbers.


Add a new helper Column E, In E2:
=ROW(C2)
drag this down till the last cell in the data range


Lookup value in H7: 01/12/2015
try the following formula in H8:
Code:
=INDEX(C$1:C$49,LARGE(IF((E$1:E$49<MATCH($H$7,C$1:C$49,0))*(D$1:D$49<>1)*(D$1:D$49<>7),ROW($C$1:$C$49)),ROW($A$1)))

=INDEX(C$1:C$49,LARGE(IF((E$1:E$49<MATCH($H$7,C$1:C$49,0))*(D$1:D$49<>1)*(D$1:D$49<>7),ROW($C$1:$C$49)),ROW($A$1)))

This needs to be array entered (to be confirmed by pressing CTRL+SHIFT+ENTER)

PM me your e-mail address if you want the sample file that I created for you!
 
Last edited:
Upvote 0
For some strange reasons I guess the system is auto correcting my formula. The actual formula is different than what I posted in the above thread. I did it twice - once with code tags and again without the code tags. Strange!!
 
Upvote 0
OK, tweaked the above formula provided and it works now. Thank you for your help CBatrody. The formula that worked is as follows:

INDEX(D$11:D$27768,SMALL(IF((E$11:E$27768>MATCH($D$4,D$11:D$27768,0))*(F$11:F$27768<>1)*(F$11:F$27768<>7),ROW($D$11:$D$27768)-10),$B6))
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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