Array formula help

mattri

New Member
Joined
May 9, 2018
Messages
2
Hi,

I'm hoping someone can help with first attempt at an array formula. I have a bank statement in the form:

IndexDateBalance
105/01/2018100
207/01/2018150
307/01/2018142
407/01/2018145
509/01/2018500

<tbody>
</tbody>

I would like to be able to type a date into a cell and be provided with a Balance for the same, or nearest previous date, with the largest index value if there are duplicates of the same date. e.g. if I typed 08/01/2018 I would like to get the result 145. I would want the same result if I typed 07/01/2018.

I have managed to get the date index using a helpful array formula from this site, but it is returning the balance for the first matching date in the list. I am unsure how to add the extra criteria to then choose the largest Index out of the matching dates.
{=INDEX(C2:C6,MATCH(MAX(IF((B2:B6<=CHOSENDATE),B2:B6)),B2:B6,0))}

Many thanks in advance.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Welcome to the forum!

How about:

=LOOKUP(2,1/(B2:B6<=CHOSENDATE),C2:C6)

assuming the indexes are in ascending order?
 
Upvote 0
Welcome to the forum!

How about:

=LOOKUP(2,1/(B2:B6<=CHOSENDATE),C2:C6)

assuming the indexes are in ascending order?

Eric

That works brilliantly and seems so simple, yet my brain hurts trying to understand it!

If there were a solution that didn't need the indexes in order then that would be helpful, but it's not essential and this will do the trick.

Many thanks.
 
Upvote 0

Forum statistics

Threads
1,216,058
Messages
6,128,539
Members
449,457
Latest member
ncguzzo

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