INDEX, MATCH OR XLOOKUP?

mickeystanford_alumni

Board Regular
Joined
May 11, 2022
Messages
129
Office Version
  1. 2021
Platform
  1. Windows
  2. MacOS
Hi, hope you are all well.
I am trying to build a formula with a sum of sumifs which one of the criterias references an index I am creating. The data looks like this:

=SUM(SUMIFS(C:C,A,A,"2010",D:D, here I want the formula to read the index "cars" in this case and kind of transpose those so that the sum includes in this case all Car brands. The result in this case should be 66.

The data is quite big so that is why I need it, to keep data clean and if any new brand gets added, I can easily include it in the data without the need to change the formula.

Thank you very much.

DATA
YEARMONTHSALESBRAND
2010​
1​
1​
MERCEDES
2010​
2​
15​
MERCEDES
2010​
3​
20​
MERCEDES
2010​
4​
30​
PORSCHE

INDEX
BRAND
CARSMERCEDESPORSCHE
PLANESBOEINGJET
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi,

its not quite so easy with the version of Excel you have, so in this case I would offer you this kind of solution, where you would give yourself a "helper" column as such.

I'm not sure if thats workable for you or not, but essentially the formula in E is establishing upfront if the car is in your Index List (eg. if E > 0). The formula can then work on that quite simply.

Book1
ABCDEFGHI
1YEARMONTHSALESBRANDHelper
2201011MERCEDES1SUMIFS
32010215FORD051
42010320MERCEDES1
52010430PORSCHE2
6
7
8INDEX
9BRAND
10CARSMERCEDESPORSCHE
11PLANESBOEINGJET
Sheet1
Cell Formulas
RangeFormula
I3I3=SUMIFS(C2:C5,A2:A5,"=2010",E2:E5,">0")
E2:E5E2=IFNA(MATCH(D2,B$10:B$11),0)
 
Upvote 0
Hi,

its not quite so easy with the version of Excel you have, so in this case I would offer you this kind of solution, where you would give yourself a "helper" column as such.

I'm not sure if thats workable for you or not, but essentially the formula in E is establishing upfront if the car is in your Index List (eg. if E > 0). The formula can then work on that quite simply.

Book1
ABCDEFGHI
1YEARMONTHSALESBRANDHelper
2201011MERCEDES1SUMIFS
32010215FORD051
42010320MERCEDES1
52010430PORSCHE2
6
7
8INDEX
9BRAND
10CARSMERCEDESPORSCHE
11PLANESBOEINGJET
Sheet1
Cell Formulas
RangeFormula
I3I3=SUMIFS(C2:C5,A2:A5,"=2010",E2:E5,">0")
E2:E5E2=IFNA(MATCH(D2,B$10:B$11),0)
Thank you Rob. Is it easier with any other version of excel? I can upgrade/update it if that would help.
Your way works, though I would prefer not to include the helper column.

Let me know if you could find a different way, as I am a bit stuck.
 
Upvote 0
How about
Excel Formula:
=SUM(FILTER(C2:C5,(A2:A5=2010)*(ISNUMBER(XMATCH(D2:D5,B10:C10)))))
Hi Fluff, that works indeed, txs.

However, the objective is to link the second part of your formula with "CARS" & "PLANES" etc...scrolling down, not just selecting the Cars brands in the XMATCH.

Then the formula, by reading "CARS", will sum all the car brands B10:C10 in this case, however, the selection there should be B10:C11 or A10:C11?

Hope its clear and again, txs a lot for your support.

2010
CARS
??
PLANES
??
 
Upvote 0
There is noway that Excel can know if something is a car or a plane, so you need someway to tell it.
 
Upvote 0
There is noway that Excel can know if something is a car or a plane, so you need someway to tell it.
Hi Fluff, agree with that. There my question if there is any way to create an index there so that the formula takes the "CARS" value and gets all the values from there.
Thanxs once again
 
Upvote 0
How about
Fluff.xlsm
ABCDEFGH
1YEARMONTHSALESBRAND
2201011MERCEDESMERCEDESCARS
32010215MERCEDESPORSCHECARS
42010320BOEINGBOEINGPLANES
52010430PORSCHEJETPLANES
6
7
8
9
10
112010
12CARS46
13PLANES20
Data
Cell Formulas
RangeFormula
B12:B13B12=SUMPRODUCT(($A$2:$A$5=B$11)*(XLOOKUP($D$2:$D$5,$G$2:$G$5,$H$2:$H$5)=A12)*($C$2:$C$5))
 
Upvote 0

Forum statistics

Threads
1,215,081
Messages
6,123,016
Members
449,093
Latest member
ikke

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