VLookup data from more than one row

marcidee

Board Regular
Joined
May 23, 2016
Messages
184
Office Version
  1. 2019
I have a spreadsheet that has one tab showing stock levels and item costs and another tab showing sales - the sales tab picks up the items and sales prices from the stock sheet etc and I want to return data the sales tab to the stock tab showing quantity sold.

I am using the following formula in the qty sold column - however if the same item is sold on more than one row it only picks up the number from the first row - can someone help me adjust the formula so that it picks up the data on every row this appears.

=IFERROR(VLOOKUP(A2,Sales!$B$2:$D$30,3,FALSE),0)

ie in the example below the qty column in the stock sheet only shows sales of 4 and not 6
03/01/2022​
Amazon Echo
17.00​
4​
09/01/2022​
Amazon Echo
17.00​
2​
Thank you for your help
Marc
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi Marcidee,

You can use SUMIF

Marcidee.xlsx
ABCD
1DateProductCostQty
23/1/2022Amazon Echo174
39/1/2022Amazon Echo172
Sales


Marcidee.xlsx
AB
1Product
2Amazon Echo6
Stock
Cell Formulas
RangeFormula
B2B2=SUMIF(Sales!B2:$B$30,A2,Sales!$D$2:$D$30)
 
Upvote 0
Hi Toadstool
Thank you very much for your response - I appear to be getting inconsistent storage results using this formula - in the 2 screen shots below you will see Amazon Echo shows as sold 5 which is correct, however Anker Nebula shows 4 but should be 7, and Bayliss straightener shows 2 but should be 1?

StockNameColumn1Item CostMark upSale PriceQty BoughtSoldStockValue of Stock
Amazon EchoActive
£17.00​
£2.00​
£19.00​
20​
6​
14​
238​
Anker NebulaActive
£319.99​
£30.00​
£349.99​
15​
4​
11​
3520​
BaByliss Berry Crush StraightenerActive
£28.00​
£28.00​
2​
2​
0​
0​
Baylis & Harding Jojoba, Vanilla & Almond Oil Luxury Bathing Duo Stack Gift Box Gift Set - Vegan Friendly…Active
£7.49​
£7.49​
10​
2​
8​
60​
Bush Big LED Alarm Clock RadioActive
£14.99​
£14.99​
3​
0​
3​
45​
Canon MG3650S WH…Active
£39.99​
£39.99​
1​
2​
-1​
-40​
Canon PIXMA TR4551Active
£49.99​
£49.99​
0​
0​
0​
0​

DateStock NamePriceSold QTYValue
03/01/2022​
Amazon Echo
19.00​
4​
76.00​
09/01/2022​
Amazon Echo
19.00​
2​
38.00​
06/01/2022​
Anker Nebula
349.99​
2​
699.98​
15/02/2022​
Anker Nebula
349.99​
5​
1749.95​
07/01/2022​
BaByliss Berry Crush Straightener
28.00​
1​
28.00​
08/01/2022​
Baylis & Harding Jojoba, Vanilla & Almond Oil Luxury Bathing Duo Stack Gift Box Gift Set - Vegan Friendly…
7.49​
1​
7.49​
02/03/2022​
Canon MG3650S WH…
39.99​
1​
39.99​
10/01/2022​
CLARINS Body Care Set 3Pc
23.10​
1​
23.10​
 
Upvote 0
It's working for me:

Marcidee2.xlsx
ABCDE
1DateStock NamePriceSold QTYValue
23/1/2022Amazon Echo19476
39/1/2022Amazon Echo19238
46/1/2022Anker Nebula3502699.98
515/02/2022Anker Nebula35051750
67/1/2022BaByliss Berry Crush Straightener28128
78/1/2022Baylis & Harding Jojoba, Vanilla & Almond Oil Luxury Bathing Duo Stack Gift Box Gift Set - Vegan Friendly…7.4917.49
82/3/2022Canon MG3650S WH…39.99139.99
910/1/2022CLARINS Body Care Set 3Pc23.1123.1
Sales


Marcidee2.xlsx
ABCDEFGHI
1StockNameColumn1Item CostMark upSale PriceQty BoughtSoldStockValue of Stock
2Amazon EchoActive1721920614238
3Anker NebulaActive319.9930349.99157113520
4BaByliss Berry Crush StraightenerActive28282100
5Baylis & Harding Jojoba, Vanilla & Almond Oil Luxury Bathing Duo Stack Gift Box Gift Set - Vegan Friendly…Active7.497.49101860
6Bush Big LED Alarm Clock RadioActive14.9914.9930345
7Canon MG3650S WH…Active39.9939.9911-1-40
8Canon PIXMA TR4551Active49.9949.990000
Stock
Cell Formulas
RangeFormula
G2:G8G2=SUMIF(Sales!$B$2:$B$9999,A2,Sales!$D$2:$D$9999)
 
Upvote 0
Solution

Forum statistics

Threads
1,215,523
Messages
6,125,317
Members
449,218
Latest member
Excel Master

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