You are here:

# Excel/sum if with index problem

Question
Dear Sir,

I have a Data list as below:

APPLE   MANGO   ORANGE
AB1   1   8   15
AB2   2   9   16
AC1   3   10   17
AB1   4   11   18
AC1   5   12   19
AC2   6   13   20
AB2   7   14   21
AC2   8   15   22

and from above data list, i am having a problem to get a sum based on below criteria as marked "??"

AB1   AB2   AC1   AC2
APPLE   ??   ??   ??   ??
MANGO   ??   ??   ??   ??
ORANGE   ??   ??   ??   ??

Thanks

Formula for Table
KHAN,

Tested in Excel 2013

Assume your first data table is in cells A1:D9  (of course A1 is blank)

Assume your AB1 AB2 AC1 AC2  are in B11:E11
APPLE
MANGO
ORANGE

are in A12:A14

in
B12:  =SUMIF(\$A\$2:\$A\$9,B\$11,INDEX(\$B\$2:\$D\$9,0,MATCH(\$A12,\$B\$1:\$D\$1,0)))

then select B2 and drag fill to the right to E12
Select B12:E12 and drag down to B14:E14

that produced this:

AB1   AB2   AC1   AC2
APPLE   5   9   8   14
MANGO   19   23   22   28
ORANGE   33   37   36   42

in A11:E14

--
Regards,
Tom Ogilvy
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.