lookupifs?? lookup value so long as date value is greater than specified date

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,056
Office Version
  1. 365
Platform
  1. Windows
I am working with an extract from our contracts database and a list of supplier expenditure. From the list of supplier spend, i have identified our Top100 suppliers. I now need to identify to which Category each supplier belongs. if the contracts data consisted of a single entry per supplier, this would not be difficult. However, with contracts, each supplier may have multiple contracts in their own right or they may be one of several parties to a contract. The contracts data can also contain expired contracts.

mockup data below
Basic spend data
Company NameExpenditureCategory
Apples1000
Bondi P/L900Construction
**** a doodle doo750
Dingo Dog Ltd725
Echo echo690Sonar
Frogs Red.yum yum574.5
Glub Pty Ltd495Chemicals
Hod P/L415.5
I-Wash336
J-Lo Inc256.5


Mock up Contract data
PartyContract NumberContract DescriptionStart DateEnd DateCategory
Bondi P/LK3456Good Stuff29/10/202028/04/2021Support Services
Glub Pty LtdK9876Bad Stuff7/09/20206/09/2021Software & Licences
Hod P/L, J-Lo Inc, Brother B, Glub Pty LtdK5264Stuff you24/11/202023/11/2021Software & Licences
Dingo Dog Ltd, Glub Pty Ltd,EK8356Your Stuff2/10/20201/12/2021ICT Services
Frogs Red.yum yumK2739My Stuff23/05/202331/07/2023Fleet & Fuel
Frogs Red.yum yumK6100Not My Stuff1/09/201831/08/2023Construction
Bondi P/LK6022Who's Stuff is this7/10/20216/10/2024Construction
Bondi P/LK8008Stuff it1/08/20221/12/2024Construction
Bondi P/LK7355OK Stuff1/04/202420/12/2024Construction
Glub Pty LtdK9087Holiday stuffing21/05/202420/05/2025Chemicals
Frogs Red.yum yum, Dingo Dog LtdK4069Get Stuffed1/07/201730/06/2025
Glub Pty Ltd14/06/202214/07/2025
Echo echo1/02/202431/01/2027Sonar
7/05/20246/05/2027

so, the result i am after is a lookup that returns the category specified in the contracts data so long as the end date has not already passed. Take Glub Pty Ltd as an example. The first three contracts involving Glub have expired so I don't want the Category associated with these. The 4th time it is listed in the contract data (K9087), the expiry date is in the future so i want that Category (Chemicals). Another example would be Bondi P/L. Contract K6022 has expired, but the next one K8008 has not.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Is this what you mean?
If there is more than one contract meeting the criteria, this formula returns the first (but it could return all if required & such a circumstance is possible)
I have assumed dates in col J will be ascending per your sample.

24 10 09.xlsm
ABCDEFGHIJK
1Company NameExpenditureCategoryPartyContract NumberContract DescriptionStart DateEnd DateCategory
2Apples1000 Bondi P/LK3456Good Stuff29/10/202028/04/2021Support Services
3Bondi P/L900ConstructionGlub Pty LtdK9876Bad Stuff7/09/20206/09/2021Software & Licences
4**** a doodle doo750 Hod P/L, J-Lo Inc, Brother B, Glub Pty LtdK5264Stuff you24/11/202023/11/2021Software & Licences
5Dingo Dog Ltd725 Dingo Dog Ltd, Glub Pty Ltd,EK8356Your Stuff2/10/20201/12/2021ICT Services
6Echo echo690SonarFrogs Red.yum yumK2739My Stuff23/05/202331/07/2023Fleet & Fuel
7Frogs Red.yum yum574.5 Frogs Red.yum yumK6100Not My Stuff1/09/201831/08/2023Construction
8Glub Pty Ltd495ChemicalsBondi P/LK6022Who's Stuff is this7/10/20216/10/2024Construction
9Hod P/L415.5 Bondi P/LK8008Stuff it1/08/20221/12/2024Construction
10I-Wash336 Bondi P/LK7355OK Stuff1/04/202420/12/2024Construction
11J-Lo Inc256.5 Glub Pty LtdK9087Holiday stuffing21/05/202420/05/2025Chemicals
12Frogs Red.yum yum, Dingo Dog LtdK4069Get Stuffed1/07/201730/06/2025
13Glub Pty Ltd14/06/202214/07/2025
14Echo echo1/02/202431/01/2027Sonar
157/05/20246/05/2027
Category
Cell Formulas
RangeFormula
C2:C11C2=INDEX(FILTER(K$2:K$15&"",ISNUMBER(SEARCH(A2,F$2:F$15))*(J$2:J$15>=TODAY()),""),1)
 
Upvote 0
Solution
Peter, what on earth did you create? are you a witch? its perfect. can you give me a little detail on how, why, and what?
 
Upvote 0
can you give me a little detail on how, why, and what?
It filters col K for the rows where the relevant company name appears in col F** and the col J date is today or later then takes the first col K value that is left after that filter.

** This name part could be a little problematic if you do really have short names like "Hod P/L". If another company was called "Flashod P/L" then an incorrect result could occur because the short name can be found within the longer name. If that is possible a more complicated formula would be required.
 
Upvote 0
thanks Pete. the names are company names as input to our ERP. (fingers crossed) there is a very small chance one name could appear within another. thinking family name businesses might be an issue (eg "J. Smith Pty Ltd" and P, R, S and J. Smith Pty Ltd) but i will do a manual check on these. thankfully, there aren't that many. cheers again.
 
Upvote 0
Here is a smaller/changed sample that shows the incorrect result in C3 with the previous formula in column C and the correct result in D3 with a replacement formula in column D that you could use in case.

ajm.xlsm
ACDEFJK
1Company NameCategoryCategoryPartyEnd DateCategory
2Glub Pty LtdSoftware & LicencesSoftware & LicencesBondi P/L29/10/2025Support Services
3Hod P/LICT ServicesSoftware & LicencesBondi P/L, Flashod P/L7/09/2025ICT Services
4Flashod P/LICT ServicesICT ServicesHod P/L, J-Lo Inc, Brother B, Glub Pty Ltd24/11/2025Software & Licences
5Apples  Dingo Dog Ltd, Glub Pty Ltd,E2/10/2025ICT Services
6J-Lo IncSoftware & LicencesSoftware & LicencesFrogs Red.yum yum23/05/2028Fleet & Fuel
7Frogs Red.yum yum1/09/2023Construction
8Glub Pty Ltd21/05/2029Chemicals
9Frogs Red.yum yum, Dingo Dog Ltd1/07/2022
10Glub Pty Ltd14/06/2027
Category (2)
Cell Formulas
RangeFormula
C2:C6C2=INDEX(FILTER(K$2:K$12&"",ISNUMBER(SEARCH(A2,F$2:F$12))*(J$2:J$12>=TODAY()),""),1)
D2:D6D2=INDEX(FILTER(K$2:K$12&"",ISNUMBER(SEARCH(","&A2&",",","&SUBSTITUTE(F$2:F$12,", ",",")&","))*(J$2:J$12>=TODAY()),""),1)
 
Upvote 0

Forum statistics

Threads
1,224,735
Messages
6,180,635
Members
452,992
Latest member
TokugawaIesuma

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