I'm struggling to sum the right values. It looked quite easy at first, but the more it try it the more complicated it seems to be. An example of my data is in an image below.
My data consists of sellinglots from an auction company, in the example there are 3 different auctions (auction01, 02 and 03) in the same table. Column B contains the LotID, D = quantity that I try to sum, E = customerID and F = status (sold or unsold).
What I try to do is sum the unsold quantity with the following criteria:
- qty per CustomerID
- only distinct LotID
- only unsold qty after all auctions. (e.g. lotID 900002 and 900005 are never sold, while 900013 is unsold at auction02 but sold at auction03 so I don't want to sum it.)
I got quite close, but I can't seem to get the last criteria implemented.
The results I want are in Cells J14 and J15, my 2 attempts for customer A are in cell I20 and I21.
Attempt 1:
=SUM(IF(FREQUENCY(IF(Table1[CustomerID]=H14;IF(Table1[Status]=J13;MATCH(Table1[LotID];Table1[LotID];0)));ROW(Table1[Qty])-ROW($D$2)+1)>0;Table1[Qty]))
Attempt 2:
=SUMPRODUCT(IFERROR((Table1[Status]&Table1[CustomerID]=J13&H14)/COUNTIFS(Table1[LotID];Table1[LotID];Table1[Status];J13;Table1[CustomerID];H14);0);Table1[Qty])
D3
+D9
+D19
). (4) Don’t clutter your data with irrelevancies. For example, you say you want to sum the unsold quantity, but you show 30 rows of data, only 9 of which are unsold. Include a few “sold” rows as filler, and enough to illustrate your third objective; but 21 seems like too many. And, while it’s good to show us the results you get from the formulas you tried, that’s not nearly as important as knowing what results you want. (And I have no idea what you’re showing us inH11:K16
.)enter image description here
” is meant to be a placeholder for an image description. An example image description would be “auction data spreadsheet”. If you don’t want to compose an image description, that’s OK (although we’d rather that you did, but thanks for editing the question to embed the image), but there’s really no point in re-inserting the “enter image description here
” placeholder.