Returning name on multiple date arrays

archibell

New Member
Joined
Mar 25, 2013
Messages
21
Office Version
  1. 365
Platform
  1. Windows
I know how to do an index match when the date is static (i.e. put a date and it returns the name), but not sure how to write the formula with multiple dates because of the lack of ability to change the array within the formula. I am sure I am missing something simple. Here is the example of the data. The promo's run between certain dates and I am trying to match weeks of syndicated data that use the 'WE DATE' to what promo might have run during that week.



NAMESTARTENDWS DATEWE DATEPROMO (OUTPUT)
PROMO 101/24/2302/15/23
01/01/23​
01/07/23​
-
PROMO 202/16/2303/08/23
01/08/23​
01/14/23​
-
PROMO 303/09/2303/29/23
01/15/23​
01/21/23​
-
PROMO 403/23/2304/12/23
01/22/23​
01/28/23​
PROMO 1
PROMO 504/04/2304/24/23
01/29/23​
02/04/23​
PROMO 1
PROMO 604/25/2305/15/23
02/05/23​
02/11/23​
PROMO 1
PROMO 705/16/2306/07/23
02/12/23​
02/18/23​
PROMO 2
PROMO 806/06/2306/28/23
02/19/23​
02/25/23​
PROMO 2
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
So, you are looking to see which promo period the WE DATE falls in? What about WS DATE? And what about when a promo period overlaps?
 
Upvote 0
Correct. The WS date is just a column I added but the syndicated data only shows the WE date. Overlaps should be minimal but they do exist, so great question. I did think about having an additional column for secondary promos...open to suggestions on how to handle those!
 
Upvote 0
Correct. The WS date is just a column I added but the syndicated data only shows the WE date. Overlaps should be minimal but they do exist, so great question. I did think about having an additional column for secondary promos...open to suggestions on how to handle those!
Not entirely sure, but here are a couple options depending on what version of excel you are using and what you want to return for the first three results.

Book1 w Stock Room 12-7-2023.xlsm
ABCDEFGHI
1NAMESTARTENDWS DATEWE DATEPROMO (OUTPUT)Formula Result EXCEL 365Formula Result Pre 365
2PROMO 11/24/20232/15/202301/01/231/7/2023-PROMO 1-
3PROMO 22/16/20233/8/202301/08/231/14/2023-PROMO 1-
4PROMO 33/9/20233/29/202301/15/231/21/2023-PROMO 1-
5PROMO 43/23/20234/12/202301/22/231/28/2023PROMO 1PROMO 1PROMO 1
6PROMO 54/4/20234/24/202301/29/232/4/2023PROMO 1PROMO 1PROMO 1
7PROMO 64/25/20235/15/202302/05/232/11/2023PROMO 1PROMO 1PROMO 1
8PROMO 75/16/20236/7/202302/12/232/18/2023PROMO 2PROMO 2PROMO 2
9PROMO 86/6/20236/28/202302/19/232/25/2023PROMO 2PROMO 2PROMO 2
Sheet6
Cell Formulas
RangeFormula
H2:H9H2=XLOOKUP(F2,$C$2:$C$9,$A$2:$A$9,"",1)
I2:I9I2=IFNA(LOOKUP(F2,$B$2:$B$9,$A$2:$A$9),"-")
 
Upvote 0
Solution
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
365. Updated the details.
 
Upvote 0
Thanks for that, have to tried the suggestions by dreid1011?
 
Upvote 0
They do work and marked as a solution. The result is not 100% like I would like but it does work so I am going with it until I think of a better solution.
 
Upvote 0
They do work and marked as a solution. The result is not 100% like I would like but it does work so I am going with it until I think of a better solution.
We can make adjustments to get as close to what you want if you let us know what is not working.
 
Upvote 0
We can make adjustments to get as close to what you want if you let us know what is not working.
Sure thing. My main issue is that I just haven't had the time to return to this problem and see what the output looks like on the full data set. Where I can foresee issues arising is that using the xlookup function, the weeks that we have promotions not running will still show a promotion name on them (i.e. the weeks prior to Promo 1 on the example table) It looks like the IFNA function solves that issue.

When I was originally looking into it I was using a formula similar to this:

=IFERROR(INDEX($A$2:$A$9,MATCH(1,(F2>=$B$2:$B$9)*(F2<=$C$2:$C$9),0),1),"-")

I must have typed something wrong because on the original sheet it was giving me an error, but in my example it seems to work well.
 
Upvote 0

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

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