Please help - subtotal using vlookup depending on variable month

R

robstton

Hi All,
I'm trying to find a value from table A in table B using vlookup and then
sum the months YTD depending on the month. So for example if I enter April
or 4
table A
Month__4___<---value entered manually
name $ytd
bob 142
mob 117
gob 152

table b
PC Jan Feb Mar Apr May Jun Jul..........Dec
bob 22 50 45 25 56 78 89 12
mob 32 25 25 35 52 85 24 15
gob 32 20 15 85 95 65 45 85

Many thanks
 
D

Dave Peterson

Maybe something like:

=SUMIF(Sheet2!A:A,"bob",
INDEX(Sheet2!A:M,,MATCH(TEXT(DATE(2008,$A$1,1),"mmm"),Sheet2!$A$1:$M$1,0)))

You can replace "bob" with the cell that contains that text (like $a2):

=SUMIF(Sheet2!A:A,$A2,
INDEX(Sheet2!$A:$M,,MATCH(TEXT(DATE(2008,$A$1,1),"mmm"),Sheet2!$A$1:$M$1,0)))

This assumes that the table b is on Sheet2 in columns A:M and the month number
is in A1 of the sheet with the formula.
 

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