LARGE IF ==> Formula question. No Array formula

Xceller

Active Member
Joined
Aug 24, 2009
Messages
265
Hi all,

I a large spreadsheet about 4000 row and 40 columns. So I cannot use array formulas to do this.

I have a range of Dates:
1/12/2011
2/25/2011
3/25/2011
4/25/2011
5/16/2011
6/17/2011
7/19/2011
8/18/2011
9/23/2011
10/4/2011
11/4/2011
12/3/2011

I would like to compare these dates from the list to 5/15/2011 for example, and pick out the the closest date (4/25/2011). How do I achieve this without an array formula?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi all,

I a large spreadsheet about 4000 row and 40 columns. So I cannot use array formulas to do this.

I have a range of Dates:
1/12/2011
2/25/2011
3/25/2011
4/25/2011
5/16/2011
6/17/2011
7/19/2011
8/18/2011
9/23/2011
10/4/2011
11/4/2011
12/3/2011

I would like to compare these dates from the list to 5/15/2011 for example, and pick out the the closest date (4/25/2011). How do I achieve this without an array formula?
Wouldn't the closest date be 5/16/2011 or do you want the closest date that is less than or equal to the lookup date?

As long as the dates are in ascending order...

Book1
ABC
21/12/2011_5/15/2011
32/25/2011__
43/25/2011_4/25/2011
54/25/2011__
65/16/2011__
76/17/2011__
87/19/2011__
98/18/2011__
109/23/2011__
1110/4/2011__
1211/4/2011__
1312/3/2011__
Sheet1

This formula entered in C4:

=INDEX(A2:A13,MATCH(C2,A2:A13))
 
Upvote 0
Thank you, T. Valko. That iss elegant.
By the way, is it possible to use the SUMPRODUCT construct to do this, something like,
=LARGE(((A2:A13<C2)*(A2:A13)),1)




<c2)*(a2:a13))*1)
<c2)*(a2:a13)),1)
<c2)*(a2:a13))*1) .="" i="" am="" not="" able="" to="" do="" it,="" but="" don't="" know="" why.
<c2)*(a2:a13))*1)
Thanks again for your help!</c2)*(a2:a13))*1)
</c2)*(a2:a13))*1)></c2)*(a2:a13)),1)
</c2)*(a2:a13))*1)
 
Last edited:
Upvote 0
Thank you, T. Valko. That iss elegant.
You're welcome!

By the way, is it possible to use the SUMPRODUCT construct to do this, something like,

=LARGE(((A2:A13<?XML:NAMESPACE PREFIX = C2)*(A2 /><C2)*(A2:A13)),1)< p> <c2)*(a2:a13))*1)< p><c2)*(a2:a13)),1)< p><c2)*(a2:a13))*1) do="" p know="" don?t="" but="" it,="" to="" able="" not="" am="" i="" .="" why.<><c2)*(a2:a13))*1)< p></c2)*(a2:a13))*1)<></c2)*(a2:a13))*1)></c2)*(a2:a13)),1)<></c2)*(a2:a13))*1)<>
<c2)*(a2:a13))*1)< p><c2)*(a2:a13)),1)< p><c2)*(a2:a13))*1) do="" p know="" don?t="" but="" it,="" to="" able="" not="" am="" i="" .="" why.<><c2)*(a2:a13))*1)< p>Thanks again for your help!
</c2)*(a2:a13))*1)<></c2)*(a2:a13))*1)></c2)*(a2:a13)),1)<></c2)*(a2:a13))*1)<>
<c2)*(a2:a13))*1)< p><c2)*(a2:a13)),1)< p><c2)*(a2:a13))*1) do="" p know="" don?t="" but="" it,="" to="" able="" not="" am="" i="" .="" why.<><c2)*(a2:a13))*1)< p>Like this:</c2)*(a2:a13))*1)<></c2)*(a2:a13))*1)></c2)*(a2:a13)),1)<></c2)*(a2:a13))*1)<>
<c2)*(a2:a13))*1)< p><c2)*(a2:a13)),1)< p><c2)*(a2:a13))*1) do="" p know="" don?t="" but="" it,="" to="" able="" not="" am="" i="" .="" why.<><c2)*(a2:a13))*1)< p></c2)*(a2:a13))*1)<></c2)*(a2:a13))*1)></c2)*(a2:a13)),1)<></c2)*(a2:a13))*1)<>
<c2)*(a2:a13))*1)< p><c2)*(a2:a13)),1)< p><c2)*(a2:a13))*1) do="" p know="" don?t="" but="" it,="" to="" able="" not="" am="" i="" .="" why.<><c2)*(a2:a13))*1)< p></c2)*(a2:a13))*1)<></c2)*(a2:a13))*1)></c2)*(a2:a13)),1)<></c2)*(a2:a13))*1)<>
<c2)*(a2:a13))*1)< p><c2)*(a2:a13)),1)< p><c2)*(a2:a13))*1) do="" p know="" don?t="" but="" it,="" to="" able="" not="" am="" i="" .="" why.<><c2)*(a2:a13))*1)< p></c2)*(a2:a13))*1)<>
</c2)*(a2:a13))*1)></c2)*(a2:a13)),1)<>=SUMPRODUCT(MAX((A2:A13<=C2)*A2:A13))

Format as Date
</c2)*(a2:a13))*1)<></C2)*(A2:A13)),1)<>
 
Upvote 0
Thanks again for the formula. It works perfect for me. Is it possible to pick up the 1st, 2nd, 3rd... largest value, such as 4/25/11, 3/25/11, 2/25/11 ?
 
Upvote 0
Thanks again for the formula. It works perfect for me. Is it possible to pick up the 1st, 2nd, 3rd... largest value, such as 4/25/11, 3/25/11, 2/25/11 ?
You can use the INDEX formula and just subtract 1 for each nth instance you want.

For example:

Book1
ABC
21/12/2011_5/15/2011
32/25/2011__
43/25/2011_4/25/2011
54/25/2011_3/25/2011
65/16/2011_2/25/2011
76/17/2011_1/12/2011
87/19/2011__
98/18/2011__
109/23/2011__
1110/4/2011__
1211/4/2011__
1312/3/2011__
Sheet1

This formula entered in C4 and copied down:

=INDEX(A$2:A$13,MATCH(C$2,A$2:A$13)-(ROWS(C$4:C4)-1))
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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