Help w/ a simple Index/Match in Pivot Table

ExcelAtEverything

Active Member
Joined
Jan 30, 2021
Messages
351
Office Version
  1. 2019
Platform
  1. Windows
Ok, this may be a lot of text, but it shouldn't be THAT complicated of a problem. I just want to be sure I'm thorough in my explanation. ;)

Below is a mocked up version of something I'm having a problem with. Imagine that the below range is a Power Pivot Table, which has additional sales numbers added to it as each day passes (via Power Query). The dates in row 3 will always ne Jan-December of the current year, and the categories in column B will pretty much always be the same. Also note that each date has 3 sections (delivery, in-store, and pickup). I've collapsed a bunch of columns just to show that these are not short rows of info. There are 3 columns for each day of the year.

Additionally, there is a Date cell in different sheet in this workbook which shows the date that the reporting should be looking at (the date is manually input by the user into that cell). For the sake of this formula that I'm asking for help with, let's refer to that date as Details!G$3 and assume that the date in it right now is 5/31/2021.

So what I need is a formula to place into my "In-Store Totals" column (not seen below) which will check the date (located at Details!$G$3, showing 5/31/2021), and as a result will return the word "Fish" because the number "8883" is the highest number in the 5/31/2021 "In-Store" column. The formula needs to be done in such a way that it allows for the category to change from day to day. In other words if I decide to look at 5/31's "Delivery" column, then the correct return would be "Bread", because the largest number is 1023.

Unless I'm mistaken this will work better as an Index/Match formula. I just can't get it to work correctly. As part of my Index/Match, I was using LARGE(MaxCat!BH5:BH13,1) to get the 8883, but I kept erroring out when I tried to use in conjunction with the MATCH function. Here is the gist of what I'm looking for, but this of course does not work.
=INDEX($B$3:$FN$13,
MATCH(LARGE(MaxCat!BH5:BH13,1),BH5:BH13,0),
MATCH(Details!G$3,$B$3:$FN$13,0))


Thanks for any help.

1622840134989.png
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Since your user is going to have to enter a date and status (Delivery,In-Store,Pickup), why not create a pivot table that just does that.

Below is a formula that might work for you but you would have to change the data ranges.
Apart from the column B reference for category each of the other data ranges appear twice.

20210605 Index Match 2 headings v02.xlsx
ABCDEFGHIJKLMNOPQRSTU
1
2
324/05/202131/05/2021InputResult
4DeliveryIn-StorePickupDeliveryIn-StorePickupYour G3 -->31/05/2021Sugar
5Eggs10.00100.001,000.0010,000.00100,000.001,000,000.00Pickup
6Milk20.00200.002,000.0020,000.00500,000.002,000,000.00
7Fish30.00300.005,000.0050,000.00300,000.003,000,000.00
8Sugar40.00400.004,000.0040,000.00400,000.004,000,000.00$B$5:$B$8Category
9$C$5:$H$8Data Body Range
10$C$3:$H$3Heading Date Line
11$C$4:$E$4Heading Status - 1st 3 columns - match to determine if we want to offset 1, 2 or 3 (converts to 0,1,2)
12
Sheet1
Cell Formulas
RangeFormula
L4L4=INDEX($B$5:$B$8, MATCH(LARGE(INDEX($C$5:$H$8,0,MATCH($K$4,$C$3:$H$3,0)+MATCH($K$5,$C$4:$E$4,0)-1),1), INDEX($C$5:$H$8,0,MATCH($K$4,$C$3:$H$3,0)+MATCH($K$5,$C$4:$E$4,0)-1), 0), 0)
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

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