Lookup on every other column

joand

Active Member
Joined
Sep 18, 2003
Messages
266
I want to get the specific rate for an amount that falls within the range. See example below. Any ideas?

Book1
ABCDEFGHIJKLMN
1DateAmountRateAmountRateAmountRateAmountRateAmountRate
2Amount25004/01/20211006%20013%30020%40030%50050%
3Date04/01/202304/01/20221007%20015%30025%40035%50055%
4Rate20%04/01/20231008%20020%30030%40040%50060%
5
6
Sheet1
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Try this:

varios 12may2023.xlsm
ABCDEFGHIJKLMN
1DateAmountRateAmountRateAmountRateAmountRateAmountRate
2Amount25001/04/20211006%20013%30020%40030%50050%
3Date01/04/202301/04/20221007%20015%30025%40035%50055%
4Rate20%01/04/20231008%20020%30030%40040%50060%
Hoja7
Cell Formulas
RangeFormula
B4B4=IF(B2<100,0,INDEX(E2:N4,MATCH(B3,D2:D4,0),MAX(IF(MOD(E2:N2,2)=0,IF(E2:N2<B2+0.001,COLUMN(E2:N2))))-3))
Press CTRL+SHIFT+ENTER to enter array formulas.
i changed G4 to 300 and I4 to 350, and the result was 20% instead of 8%

Sample.xlsx
ABCDEFGHIJKLMN
1DateAmountRateAmountRateAmountRateAmountRateAmountRate
2Amount25004/01/20211006%20013%30020%40030%50050%
3Date04/01/202304/01/20221007%20015%30025%40035%50055%
4Rate20%04/01/20231008%30020%35030%40040%60060%
Sheet1
Cell Formulas
RangeFormula
B4B4=IF(B2<100,0,INDEX(E2:N4,MATCH(B3,D2:D4,0),MAX(IF(MOD(E2:N2,2)=0,IF(E2:N2<B2+0.001,COLUMN(E2:N2))))-3))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
If you have 365 or 2021 try
Excel Formula:
=LET(f,FILTER(E2:N4,YEAR(D2:D4)=YEAR(B3)),INDEX(f,XMATCH(B2,f,-1)+1))
wow, i like this code. giving me the correct result. could you explain how this works?
 
Upvote 0
It filter the data to only return the row of interest & then finds the exact match, or next lower value, compared to B2 & then returns the col to the right of that match
 
Upvote 0
What would be the tweak if i start adding a date range (start and end dates)

Sample.xlsx
ABCDEFGHIJKLMNO
1Date StartDate EndAmountRateAmountRateAmountRateAmountRateAmountRate
2Amount25004/01/202203/31/20231006%20013%30020%40030%50050%
3Date04/01/202304/01/202304/15/20231007%20015%30025%40035%50055%
4Rate#VALUE!04/16/202304/30/20231008%30020%35030%40040%60060%
Sheet1
Cell Formulas
RangeFormula
B4B4=LET(f,FILTER(F2:O4,YEAR(D2:D4)=YEAR(B3)),INDEX(f,XMATCH(B2,f,-1)+1))
 
Upvote 0
How about
Excel Formula:
=LET(f,FILTER(F2:O4,(D2:D4<=B3)*(E2:E4>=B3)),INDEX(f,XMATCH(B2,f,-1)+1))
 
Upvote 0
My suggestion would be to make your look table more flat.
with only these columns: Start Date (preferably only the 1st or Last of each month), End Date (which may not be necessary in this structure), Amount, Rate.


ignore please.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,496
Members
449,089
Latest member
Raviguru

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