vlookup - first subsequent/previous cell value if searched value not found

GregMax

New Member
Joined
Oct 3, 2017
Messages
2
Hello,

please I need help with one problem.

I have currency list for a period and specific dates I need to get the currency for.
E.g.
A B
24.07.2017 7,4098 kn
21.07.2017 7,4110 kn
20.07.2017 7,4103 kn
19.07.2017 7,4143 kn
13.07.2017 7,4138 kn
11.07.2017 7,4111 kn

If date is e.g. 19.07.2017 (in A8) the searched value, with vlookup formula VLOOKUP(A8; $A$1:$B$6;2;FALSE) (in B8) would give 7,4143 kn.

But when I have e.g. 23.7.2017 the vlookup function displays #n/a, because for that date there is no currency value. In these cases, how can I edit formula to search for first previous valid date and displays currency value from that date? In this case this would be 21.7.2017 and value I would need is 7,4110kn.

I assume it is simple solution, but....

thx!!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
order the table from earliest to latest date
and use
=VLOOKUP(A8,$A$1:$B$6,2,TRUE)
 
Upvote 0
quick answer is to sort you list from oldest date to newest date Ie: 11.07.2017 in A1 and 24.07.2017 in A6. then remove the false from your formula.

hth,

Ross
 
Upvote 0
Excel Workbook
ABC
111/07/201774,111kn
213/07/201774,138kn
319/07/201774,143kn
420/07/201774,103kn
521/07/201774,110kn
624/07/201774,098kn
7
823/07/2017#N/A74110
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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