Index/Match with multiple criteria from two tables (both columns and rows)

tinderbox22

Board Regular
Joined
Mar 9, 2010
Messages
56
Office Version
  1. 365
Platform
  1. Windows
Hello.
I'm attempting to do a multi-criteria lookup with data that sits in two different tables. I've attempted both an INDEX and a SUMPRODUCT option and can't seem to get the syntax right.

In basic terms, info looks like this:

TABLE 1 - MEDIA VEHICLES (C5:D8):
C5: TV
C6: CABLE
C7: SPONSORSHIP1
C8: SPONSORSHIP2
In D5:D8, I enter either 'yes' or 'no.'

TABLE 2 - DATA (F4:J16)
column F contains Months Jan through Dec, starting with F5 and down to F16
columns G through J contain the name of the medium listed in C5:C8: G4 is TV, H4 is CABLE, I4 is SPONSORSHIP1, and J4 is SPONSORSHIP2
in G5:J16 are numbers that need to be aggregated by a multi-criteria lookup.

So, I'm looking to create a new table where cells B2:B13 look up values based on the month and whether or not there is a "yes" listed in the media section.
My new table will look like this:

A2:A13 = months
B2:B13 = totals

How do I get the INDEX to read two tables like this? In other words, I'm struggling with, if, for example, any cell in D5:D8 contain a 'yes,' then match it to the cells in G4:J4 and return the data in those columns. If a cell in D5:D8 contain a 'no,' then don't read that corresponding column in G4:J4.

Let me know if this does not make sense.
Thank you.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try:

Book1
ABCDEFGHIJ
1
2Jan13
3Feb20
4Mar8TVCABLESPONSORSHIP1SPONSORSHIP2
5Apr21TVyesJan5268
6May17CABLEyesFeb10829
7Jun20SPONSORSHIP1yesMar1616
8Jul14SPONSORSHIP2noApr10921
9Aug6May10349
10Sep13Jun6596
11Oct15Jul4644
12Nov20Aug2224
13Dec22Sep3739
14Oct31022
15Nov8391
16Dec39103
Sheet2
Cell Formulas
RangeFormula
B2:B13B2=MMULT(G5:J5,--($D$5:$D$8="yes"))


You can also use SUMPRODUCT like this:

=SUMPRODUCT(--(TRANSPOSE($D$5:$D$8)="yes"),G5:J5)

but it requires Control+Shift+Enter, and is longer regardless.
 
Upvote 0
So, the MMULT returned a VALUE error since some of my data cells have no data in them. Is there a way to squeeze an IFERROR statement within this function to not count the errors?

The SUMPRODUCT function worked though, so for now I can use that.
 
Upvote 0
Right, the SUMPRODUCT treats anything non-numeric as a 0, while the MMULT throws an error. You can convert a space to a 0 by adding a 0 to it, so your B2 formula would just be:

=MMULT(G5:J5+0,--($D$5:$D$8="yes"))

If there are actual text values in your range, this won't work.
 
Upvote 0
That worked. The +0 is the answer to the MMULT issue. Thanks again for all the help!
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,200
Members
449,072
Latest member
DW Draft

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