sumif with a lookup formula

C

Chas

I need a forumla that will work like a sumif but I need to do a lookup to
determine the column that is summed. In the example worksheet below, on
sheet 1 cell B2, i need a formula that will sum from sheet 2 Column C for all
the 3100 references. The dates on Sheet 2 can change so the Column
refernence could change. I tried using a vlookup, with a match/indirect
forumla to return the column number, but with multiple 3100's, that formula
doesn't sum the numbers.


Sheet1
Column A ColumnB Column C Column D
Labor cat 07/01/09 08/01/09 09/01/09
3100
4200
5200

Sheet 2
Column A ColumnB Column C Column D
Labor cat 06/01/09 07/01/09 09/01/09
3100 25 72
30
4200 15 20
80
5200 50 60
3
3100 23 52
5

Any help is greatly appreciated, and if i can clarify anything just let me
know.

Thanks!
 
T

T. Valko

Try this...

=SUMIF(Sheet2!$A$2:$A$100,$A2,INDEX(Sheet2!$B$2:$D$100,MATCH(B$1,Sheet2!$B$1:$D$1,0)))
 
S

Shane Devenshire

Hi,

Try something like this

=SUMPRODUCT((Sheet2!$A$2:$A$9=$A2)*(Sheet2!$B$1:$D$1=B$1)*Sheet2!$B$2:$D$4)
 
B

barry houdini

T. Valko;468597 said:
Try this...

=SUMIF(Sheet2!$A$2:$A$100,$A2,INDEX(Sheet2!$B$2:$D$100,MATCH(B$1,Sheet2!$B$1:$D$1,0)))

Hello Biff,

Surely that doesn't work as written? Needs a zero for the row argumen
in INDEX, i.e.

=SUMIF(Sheet2!$A$2:$A$100,$A2,INDEX(Sheet2!$B$2:$D$100,0,MATCH(B$1,Sheet2!$B$1:$D$1,0))
 
T

T. Valko

Surely that doesn't work as written?

You're right, now that I look at it.

Wrote it off the top of my head. Should've at least written it in Excel then
I would've seen the problem.
 
T

T. Valko

=SUMIF(Sheet2!$A$2:$A$100,$A2,INDEX(Sheet2!$B$2:$D$100,MATCH(B$1,Sheet2!$B$1:$D$1,0)))

Actually, there's a problem with that formula.

Thanks to Barry for catching it. Try it like this:

=SUMIF(Sheet2!$A$2:$A$100,$A2,INDEX(Sheet2!$B$2:$D$100,0,MATCH(B$1,Sheet2!$B$1:$D$1,0)))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top