Hello all.
I'm trying to have a formula look at a list of contracts and come back with the contract rule depending on the date of an order. For example, I have a list of several contracts (listed on a separate sheet of the workbook) but one customer has two separate contracts for one customer - one (the older contract) with effective dates of of 01/01/19 - 04/30/2019 and another (the new contract) with effective dates of 05/01/19 - 04/30/2020. Each of these contracts has a specific rule (days to charge the customer). On the old contract, the rule is to bill 3 days, the new 5 days. The rules are for several customers (Several different names).
On the list of orders, there are different orders created that fall into these different contract rules. The order dated 04/29/2019 should come back with a rule bill 3 days. The order dated 05/03/2019 should come back with a rule bill 5 days.
The formula I thought would easily work is =IF(COUNTIFS(Contracts!G:G, "<="&Order!C2, Contracts!H:H, ">="&Order!C2,Contracts!B:B, "*"&A2&"*"), VLOOKUP("*"&A2&"*", Contracts!B:I, 3, FALSE), "No Rule")
You might ask the question "why the wild cards for the name look up?". The reason is the entry point is manual (by a person) and for ease of that, they are only entering the key word for the company name but the contract shows the full name... for example: Entry of Richard would bring back the rule for RICHARD NICKS AND CO.
Please help me figure this out. Need the correct rule to come back depending on the order date. Thanks. Workbook attached.
Bookmarks