Mach Closest Date and enter a value

Loukas

New Member
Joined
May 25, 2011
Messages
3
Hi,

I have two array columns; column A has dates and column B has values. I have onther column C with dates which are not always mach with the dates on column A. I want a formula which will look at column A and mach the date of columns A and C, if the dates are not matching look for previous closest date and put the value in column D.
A B
<table border="0" cellpadding="0" cellspacing="0" width="139"><colgroup><col style="mso-width-source:userset;mso-width-alt:2742;width:56pt" width="75"> <col style="width:48pt" width="64"> </colgroup><tbody><tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt; width:56pt" align="right" height="20" width="75">31/03/2011
</td> <td style="width:48pt" align="right" width="64">69</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">28/02/2011</td> <td align="right">67</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">31/01/2011</td> <td align="right">63</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">31/12/2010</td> <td align="right">69</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">30/11/2010</td> <td align="right">68</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">31/10/2010</td> <td align="right">59</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">30/09/2010</td> <td align="right">55</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">31/08/2010</td> <td align="right">49</td> </tr> </tbody></table>
The result it will be like that
C D
2/04/2011 69
3/03/2011 67
29/02/2011 67
30/01/2011 69

Thanks in advance
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Welcome to the board...

If you can sort your data ASCENDING by column A, then you can use this in D1

=INDEX(B:B,MATCH(C1,A:A,1))

Hope that helps.
 
Upvote 0
Thanks for your prompt reply.
I cannot sort the data. Both dates are starting from the most recent.

I think the solution is a combination of index and match functions
 
Upvote 0
Thanks for your prompt reply.
I cannot sort the data. Both dates are starting from the most recent.

I think the solution is a combination of index and match functions
Try this...

Book1
ABCDE
26/8/200110_2/11/200922
38/23/200194_10/13/20076
412/3/200260_11/17/200194
511/12/2004100_10/25/20076
66/26/20066_2/9/200822
711/28/200722___
82/26/200916___
92/22/20107___
108/30/20124___
Sheet1

This array formula entered in E2 and copied down:

=INDEX(B$2:B$10,MATCH(MAX(IF(A$2:A$10<=D2,A$2:A$10)),A$2:A$10,0))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Note that I sorted the dates in column A just to make it easier to see what result you will get.
 
Upvote 0

Forum statistics

Threads
1,224,509
Messages
6,179,192
Members
452,893
Latest member
denay

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