Using =sum for duplicate ID in VLOOKUP

RBerry

New Member
Joined
Oct 25, 2022
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hi, first post so hope I’m doing it correct, but here goes:

I own a business, and my employees have ID numbers.
I use VLOOKUP for their names, but our system sometimes leaves the names off and just uses their ID numbers.

How would I find their duplicate sales and add it into one cell using a VLOOKUP formula?

The closest I have got is: =sum(VLOOKUP(C4, sales, $c$2:$j$150,8,FALSE)+VLOOKUP(C4, sales, $c$2:$j$150,8,FALSE)
I know this is wrong because it added the same cell twice, and I only want it to “sum” if it’s a duplicate?

Thanks in advance
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Something like this should work i think? Do you mean duplicate for employee ID? That's what I assumed.

Book1
ABCD
1IDEmp NameSales
2123Jon Doe$ 1,000.00
3234Suzy Cook$ 1,500.00
4345Keith Miller$ 2,000.00
5123Jon Doe$ 750.00
6345Keith Miller$ 650.00
7123Jon Doe$ 500.00
8234Suzy Cook$ 1,200.00
9567Mike Jordan$ 5,000.00
10891Dennis Rodman$ 4,876.00
11891Dennis Rodman$ 3,587.00
12Total$ 21,063.00
13
14IDTotal Sales
15123$ 2,250
16234$ 2,700
17345$ 2,650
18567$ 5,000
19891$ 8,463
20
21$ 21,063
22check$ -
Sheet1
Cell Formulas
RangeFormula
D12D12=SUM(D2:D11)
A15:A19A15=UNIQUE(A2:A11)
B15:B19B15=SUMIFS($D$2:$D$11,$A$2:$A$11,A15)
B21B21=SUM(B15:B19)
B22B22=B21-D12
Dynamic array formulas.
 
Upvote 0
Solution
No problem, if i could give you a rating, 5* for sure.
I have a question kind of related to my last post, but slightly different, can i ask it here or in a new thread?
 
Upvote 0
No problem, if i could give you a rating, 5* for sure.
I have a question kind of related to my last post, but slightly different, can i ask it here or in a new thread?
Sure thing
 
Upvote 0
OK, so if i had a list of the ID's, but some of the names were missing from the "Names" column, is there a formula that would link the ID to the name.
So if i input only the ID, or only the ID was generated, the cell next to it would automatically generate the correct name?
 
Upvote 0
Shouldn't be a problem. You can reference C15:C19 for this example. Let me know if this is what you meant?

Book1.xlsx
ABCD
1IDEmp NameSales
2123Jon Doe$ 1,000
3234Suzy Cook$ 1,500
4345Keith Miller$ 2,000
5123Jon Doe$ 750
6345Keith Miller$ 650
7123Jon Doe$ 500
8234Suzy Cook$ 1,200
9567Mike Jordan$ 5,000
10891Dennis Rodman$ 4,876
11891Dennis Rodman$ 3,587
12Total$ 21,063
13
14IDTotal SalesName
151232250Jon Doe
162342700Suzy Cook
173452650Keith Miller
185675000Mike Jordan
198918463Dennis Rodman
20
2121063
22check0
Sheet2
Cell Formulas
RangeFormula
D12D12=SUM(D2:D11)
A15:A19A15=UNIQUE(A2:A11)
B15:B19B15=SUMIFS($D$2:$D$11,$A$2:$A$11,A15)
C15:C19C15=IFERROR(VLOOKUP(A15,A2:B11,2,FALSE),"")
B21B21=SUM(B15:B19)
B22B22=B21-D12
Dynamic array formulas.
 
Upvote 0
Yes, that is great. Could i expand on that, so say if i had a product range, i could insert a "Product ID", and then it would generate Product Name, Product Description, Buy In Price, Sell Price (This is all in a sheet already, so i would just need to use this as the range)? So there would essentially be 4+ cells within the range to generate. Would it simply be changing the look up range? =IFERROR(VLOOKUP(A15,A2:E11,2,FALSE),"")
The answer, again, is perfect though, thank you
 
Upvote 0
Yes, that is great. Could i expand on that, so say if i had a product range, i could insert a "Product ID", and then it would generate Product Name, Product Description, Buy In Price, Sell Price (This is all in a sheet already, so i would just need to use this as the range)? So there would essentially be 4+ cells within the range to generate. Would it simply be changing the look up range? =IFERROR(VLOOKUP(A15,A2:E11,2,FALSE),"")
The answer, again, is perfect though, thank you
If you can upload an example with XL2BB that would be best. Or a sample of your sheet with a screen shot (even if you use snipping tool to capture and paste here)?

First of all its not that simple to just change the range you would most likely need additional lookups that I could easily provide some guidance on with a sample of the data.

Either way there is a solution but since you are using Office 365 there are a few ways to handle this. With your expanded data there maybe a better solution. I just need to understand how the data is inputted.

For example. Product names for same Employee ID's are these always the same product names for all employee's i would guess no. And how do you want to pull the data list all Products in one cell?

Long and short of it is please upload some how a sample of your data and we can get you on the right track.

You may want to post in a new thread just FYI so others don't think its solved and may chime in too. Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,422
Messages
6,119,396
Members
448,891
Latest member
tpierce

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