Index and Match for date range

Keegan4123

New Member
Joined
Mar 30, 2022
Messages
29
Office Version
  1. 2016
Platform
  1. Windows
I have a data entry sheet where we input daily sales based on type of product sold. I want to cross reference to have the client, and the date the product was sold to return a price on the product. The clients change on a line by line basis but remain constant and match with individual client rate sheets. As rates increase we continue the client rate sheet with new dates and new rates.

Index Match Example.xlsx
ABCDEFGHIJKLM
1Sheet 1 in fileSheet 2 in file
2Data Entry SheetJoes Rate SheetAprils Rate Sheet
3ClientTypeRateRate should beCurrent Till DateTypeRateCurrent Till DateTypeRate
401-Jan-22JoeAppleIndex/Match Formula$ 0.7530-Apr-22Apple$ 0.7530-Apr-22Apple$ 1.00
501-Jan-22AprilOrangeIndex/Match Formula$ 2.0030-Apr-22Orange$ 1.7530-Apr-22Orange$ 2.00
601-Jan-22JoeGrapeIndex/Match Formula$ 2.7530-Apr-22Grape$ 2.7530-Apr-22Grape$ 3.00
701-Jan-22AprilMangoIndex/Match Formula$ 4.0030-Apr-22Mango$ 3.7530-Apr-22Mango$ 4.00
801-Jan-22JoePineappleIndex/Match Formula$ 4.7530-Apr-22Pineapple$ 4.7530-Apr-22Pineapple$ 5.00
901-Mar-22AprilAppleIndex/Match Formula$ 1.5001-Nov-22Apple$ 1.2501-Nov-22Apple$ 1.50
1001-Mar-22JoeOrangeIndex/Match Formula$ 2.2501-Nov-22Orange$ 2.2501-Nov-22Orange$ 2.50
1101-Mar-22AprilGrapeIndex/Match Formula$ 3.5001-Nov-22Grape$ 3.2501-Nov-22Grape$ 3.50
1201-Mar-22JoeMangoIndex/Match Formula$ 4.2501-Nov-22Mango$ 4.2501-Nov-22Mango$ 4.50
1301-Mar-22AprilPineappleIndex/Match Formula$ 5.5001-Nov-22Pineapple$ 5.2501-Nov-22Pineapple$ 5.50
1402-Nov-22JoeAppleIndex/Match Formula$ 1.50today()Apple$ 1.50today()Apple$ 1.75
1502-Nov-22AprilOrangeIndex/Match Formula$ 2.75today()Orange$ 2.50today()Orange$ 2.75
1602-Nov-22JoeGrapeIndex/Match Formula$ 3.50today()Grape$ 3.50today()Grape$ 3.75
1702-Nov-22AprilMangoIndex/Match Formula$ 4.75today()Mango$ 4.50today()Mango$ 4.75
1802-Nov-22JoePineappleIndex/Match Formula$ 5.50today()Pineapple$ 5.50today()Pineapple$ 5.75
19
20
21Date will be manual entered, Type will be drop down, rate will be the lookup from the rate sheetWould like to have the rate sheets saved as named dynamic tables for easy referencing and reduce risk of breaking formulas as things grow
22
23
24
Sheet1
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Using tables makes this easy and flexible. You just need 3 quick set-up steps.

First, select the client tables and give them names ... I used \\[client name]. e.g., \\Joe, \\April, \\Ed (You don't need the \\ but I use them to distinguish tables from ranges.)
Then, name the results table. Doesn't matter what you name it.
Finally, add a named range for the Current Till Data and Type columns in one of the customer tables - put the name in square brackets. You just need to do this for 1 table.

Name: \TillDate
Refersto: ="["&\\JOE[[#Headers],[Current Till Date]]&"]"

Name: \Type
Refersto: ="["&\\JOE[[#Headers],[Type]]&"]"

Setup is done. The rate formula is now ...

=INDEX(INDIRECT("\\"&[@Client]),MATCH(1,([@Date]=INDIRECT("\\"&[@Client]&\TillDate))*([@Type]=INDIRECT("\\"&[@Client]&\Type)),0),3)

NOTE: This is an array formula, so do a CTRL + SHIFT + ENTER. Then copy the formula down.

FWIW, you can add as many criteria as you want just put them into the MATCH function: MATCH(1,(Value1=Range1)*(Value2=Range2)*(ValueN=RangeN),0)

This provides a lot of automatic flexibility ... every range will adjust as the Rates tables get more rows. To add a new client, just copy an existing table, paste it where you want and rename the new table \\[client name]. You can also do this to move tables if you need to. To change column headers, just type the new ones into the table headers. The formula take care of the rest.

A few caveats - no spaces permitted in table names, Rate table column headers cannot be formulas and need to be identical in every table.

1670899045875.png
 
Upvote 0
Hi @mmhill

I think this should work, However running into a problem, not sure where but getting an error when I try use the formula that the syntax of the name isn't correct. I don't have any spaces, or anything in there not sure what is happening.
 
Upvote 0
@mmhill Disregard, got it figured out and it is working well so far in trials, have yet to put into practice on our actual working sheet, and a bit concerned with it being an array formula and if it might cause issues with calculation speed, but hopefully should be ok.
 
Upvote 0
@mmhill Disregard, got it figured out and it is working well so far in trials, have yet to put into practice on our actual working sheet, and a bit concerned with it being an array formula and if it might cause issues with calculation speed, but hopefully should be ok.

Didn't see you rmessage until just now. Good to hear. I don't think you're going to see much speed issues unless you are dealign with very large tables. If that is the case, you are much better off treating the source table as a data base and doing a simple SQL query on it.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
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