Lookup With Gaps

Steve 1962

Active Member
Joined
Jan 3, 2006
Messages
379
Office Version
  1. 365
Platform
  1. Windows
Hi All

Trying to find a lookup formula that lives in columns B & C, that refers to a source table that lives in columns E, F & G.
I want the lookup to return a value from column G that corresponds with the lookup date (column A) & category (columns A or B). However, there are both gaps in the dates of the lookup and source (not sequential).
If the lookup date (column A) is not found in the source date (column E), then return the value from the nearest earlier date associated with column G.
Thanks

Book1
ABCDEFG
1DateABDateCategoryValue
23/06/20248/06/2024B55
34/06/202410/06/2024A60
45/06/202411/06/2024B21
56/06/202416/06/2024B23
67/06/202416/06/2024A11
710/06/20246055For Cat B - Require value from nearest earliest date18/06/2024B53
811/06/20242119/06/2024Z85
912/06/202422/06/2024F54
1013/06/2024
1114/06/2024
1217/06/20241123For Cat A - Require value from nearest earliest date
1318/06/202453
1419/06/2024
Sheet6
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try:

Book1
ABCDEFG
1DateABDateCategoryValue
26/3/2024  6/8/2024B55
36/4/20246/10/2024A60
46/5/20246/11/2024B21
56/6/20246/16/2024B23
66/7/20246/16/2024A11
76/10/20246055For Cat B - Require value from nearest earliest date6/18/2024B53
86/11/202460216/19/2024Z85
96/12/202460216/22/2024F54
106/13/20246021
116/14/20246021
126/17/20241123For Cat A - Require value from nearest earliest date
136/18/20241153
146/19/20241153
15
Sheet10
Cell Formulas
RangeFormula
B2:C14B2=IFERROR(VLOOKUP($A$2:$A$14,FILTER($E$2:$G$9,$F$2:$F$9=B1),3),"")
Dynamic array formulas.
 
Upvote 0
Thanks Eric W - nearly there.
Just need to have blanks in dates that have past. EG: require the 60 value in B7 but not from there on (require blanks in cells B6 to B11) and do not require value 21 in cells C9 to C11.
 
Upvote 0
Try this:

Book1
ABCDEFG
1DateABDateCategoryValue
23/6/2024  8/6/2024B55
34/6/2024  10/6/2024A60
45/6/2024  11/6/2024B21
56/6/2024  16/6/2024B23
67/6/2024  16/6/2024A11
710/6/20246055For Cat B - Require value from nearest earliest date18/6/2024B53
811/6/2024 2119/6/2024Z85
912/6/2024  22/6/2024F54
1013/6/2024  
1114/6/2024  
1217/6/20241123For Cat A - Require value from nearest earliest date
1318/6/2024 53
1419/6/2024  
Sheet1
Cell Formulas
RangeFormula
B2:C14B2=IFERROR(LOOKUP(2,1/($F$2:$F$9=B$1)/($E$2:$E$9<=$A2)/($E$2:$E$9>N($A1)),$G$2:$G$9),"")
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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