问题
I would like to have the following:
- List of unique values from another list
- Total occurrences of that value in the other list
- Total price of the items per Item cost
Play here: https://docs.google.com/spreadsheets/d/11EHm7N4iK8N9oLb8VXrycTwPVHLmoBay4Z6dugaOr7I/edit?usp=sharing
Thank you in advance!
回答1:
Edit
As requested:
"How about ordering the list in Item Cost from highest to lowest?"
=QUERY(A1:C9,"select A, sum(B), sum(B)*C where A is not null
group by A, C order by sum(B)*C desc label sum(B) 'Total Quantity', sum(B)*C 'Item Cost'" )
Original answer
Please use the following formula
=QUERY(A1:C9,"select A, sum(B), sum(B)*C where A is not null
group by A, C label sum(B) 'Total Quantity', sum(B)*C 'Item Cost'" )
(adjust ranges to your needs)
Functions used:
- QUERY
回答2:
Modify this example for your requirements.
Query:
=QUERY (A2:B7,"select A,sum(B) group by A")
Screenshot:
回答3:
The best way is you should try first and come up with what you have tried/ Your output with formulas is ready in a same sheet please let me know if you have any doubt about it.
Item Name are under the range E13:E16 used this formula in cell F13 for count and dragged it out upto F16 =sumifs(B$2:B$7,A$2:A$7,E13)
Used this formula under the cell G13 and dragged it up to G16 for cost =vlookup(E13,A$2:C$7,3,False)*F13
Those changes have a restricted access to edit for me and you only.
来源:https://stackoverflow.com/questions/62069641/count-all-unique-values-in-list-their-total-quantity-and-total-price-per-item