Index formula with matching - Can it look at rows and columns?

usnapoleon

Board Regular
Joined
May 22, 2014
Messages
110
Office Version
  1. 365
Platform
  1. Windows
Hello
I have an Index formula that currently looks for its result by matching an outlet. It's here, the Tax formula in B17

=IFERROR(INDEX(I$40:I$43,MATCH("Blue River Lounge",A$40:A$43,0)),0)

But I have a problem, let me share with you my template (top) which looks through exported data (below).

04 Audit Breck.xlsx
ABCDEFGHI
17Tax60.79Cash0.00LoungeMarket
18Food364.50Gift Card0.00398.67
19Beverages114.50Card398.67263.74
20Alcohol206.10House Account362.90
21Activities0.00Other59.84
22Other Categories0.00Check0.00
23Credit Card Fees12.81
24UnclassifiedVariance to Square Input "J13"
25834.22834.22($0.00)
26Variance Sales/Payment0.00
27
28
29
30Key Stats
31Filtered By Location: Blue River Lounge, The Market
32Sales56
33Avg. Gross Sale$19.05
34Gross Sales$1,067.00
35Total Collected$1,188.73
36
37Sales Summary
38Display By Location
39Filtered By Location: Blue River Lounge, The Market
40Sales Summary Displayed by LocationGross SalesItemsService ChargesRefundsDiscounts & CompsNet SalesGift Card SalesTax
41The Market$343.00######$0.00$0.00($17.40)$325.60$0.00$28.91
42Blue River Lounge$724.00######$0.00$0.00($38.90)$685.10$0.00$60.79
28
Cell Formulas
RangeFormula
H18H18='28'!E19
I19I19='28'!K7
E17:E18,E20:E21E17=IFERROR(INDEX(J$30:J$80,MATCH(1,(A$30:A$80="Blue River Lounge")*(B$30:B$80=D17),0)),0)
E19E19=SUM(FILTER($J$30:$J$80,(LEFT($B$30:$B$80,4)=D19)*($A$30:$A$80=TEXTAFTER($A$15," ",1)),0))+SUMIFS($J$30:$J$80,$B$30:$B$80,"Cash App",$A$30:$A$80,"blue river lounge")
B17B17=IFERROR(INDEX(I$40:I$43,MATCH("Blue River Lounge",A$40:A$43,0)),0)
B18:B22B18=IFERROR(INDEX(H$30:H$90,MATCH(1,(A$30:A$90="Blue River Lounge")*(B$30:B$90=A18),0)),0)
E23E23=IFERROR(-INDEX(M$40:M$43,MATCH("Blue River Lounge",A$40:A$43,0)),0)
B25,E25B25=SUM(B16:B24)
F25F25=IFERROR(E25-INDEX(L$40:L$43,MATCH("Blue River Lounge",A$40:A$43,0)),0)
D26D26=B25-E25


My problem is - on occasion - the export gets modified. I cannot control that. It will add columns, which shoves over the existing columns. This means, the column I indicated as the tax amounts... column I in this case... could change to column J or whatever. I have to manually update the formulas. Today, it happened. Tax used to be column G, now it's I. No warning, just happens.

I was wondering if it were possible to modify this formula to look at a range of columns (instead of a single column). It will give a result based on matching the row's identifying outlet (such as 'Blue River Lounge' in A42) and also matching the column's name (such as Tax in I40) with the description in the template (A17). This way, if the numbers get shuffled around, it won't matter... Tax could be in column J or column D, the formula would still look for a column in row 40 that matches the name in A17, and give the results that also match it to the outlet.

I've done multiple matches before, but it's always based on single column matches, like this =IFERROR(INDEX(J$30:J$80,MATCH(1,(A$30:A$80="Blue River Lounge")*(B$30:B$80=D17),0)),0) I've never had a range that expands over multiple columns, and I dont know if it's possible.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You correctly realized that you need a double Match; for example:
Excel Formula:
=IFERROR(INDEX($A$40:$Z$42,MATCH("Blue River Lounge",$A$40:$A$42,0),MATCH(A17,$A$40:$Z$40,0)),0)
This assumes that A17 contains "Tax"

Try...
 
Upvote 0
Solution
You correctly realized that you need a double Match; for example:
Excel Formula:
=IFERROR(INDEX($A$40:$Z$42,MATCH("Blue River Lounge",$A$40:$A$42,0),MATCH(A17,$A$40:$Z$40,0)),0)
This assumes that A17 contains "Tax"

Try...
Sweet!!! Thank you!!!!! it works like a charm, and I understood the coding!
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

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