Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a Vlookup formula 1

Status
Not open for further replies.
May 17, 2006
54
US
I need help creating a formula that will add column B to the sum of D where column A = column C.

Column C can have multiple entries for column A so a sum is needed in the vlookup. There might not be anything in C for every A.

C and D would be used as the table array

A B C D

20-0042 13.00 20-0125 1
20-0043 2.00 20-0562 2
20-0061 2.00 20-2519 1
20-0065 16.00 20-9150 1
20-0125 21.00 25-0548 1
20-0172 2.00 25-5492B 1
20-0174 3.00 25-8024A 1
20-0179 15.00 25-8879B 1
20-0180 2.00 25-9030 1
20-0240 13.00 25-9031 1
20-0241 20.00 30-0154 1
20-0242 2.00 30-0154 1
20-0243A 24.00 30-1389 1

Thanks for your time ....
 
Not sure I follow your requirement. Perhaps an example? However vlookup can only return a single value. You will want Sumif or sumproduct I suspect.

Gavin
 
Maybe (using named ranges and depending on your needs):
=SUMPRODUCT(--(ColA=ColC),ColD)

Or in E2 (and copied down):
=SUMIF(ColA,C2,ColD)

Gavin
 
Copied your data into my spreadsheet

No Vlookups required, just a sumif
Code:
=B2+SUMIF($C$2:$C$14,A2,$D$2:$D$14)
 



Hi,

Please post a relevant example that is related to the data you posted.

In your example column A row 5 matches column C row 1. So what does that mean?

You also state, "Column C can have multiple entries for column A," so where is THAT illustrated in your example?

Please be CLEAR, CONCISE and COMPLETE when you post.

Please use TGML [ignore][tt]...[/tt][/ignore] tags. If you do not know what that is, do a FIND on this sheet and follow the link. Your properly formatted example, ought to appear something like this...
[tt]
A B C D

20-0042 13.00 20-0125 1
20-0043 2.00 20-0562 2
20-0061 2.00 20-2519 1
20-0065 16.00 20-9150 1
20-0125 21.00 25-0548 1
20-0172 2.00 25-5492B 1
20-0174 3.00 25-8024A 1
20-0179 15.00 25-8879B 1
20-0180 2.00 25-9030 1
20-0240 13.00 25-9031 1
20-0241 20.00 30-0154 1
20-0242 2.00 30-0154 1
20-0243A 24.00 30-1389 1
[/tt]


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks Gruuuu, your formula worked perfectly.

Skip, thanks for the info on the TGML tags, I'll check them out for the next time.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top