简体   繁体   中英

Google Sheets - Perform VLOOKUP on every row in column and return sum

I have a spreadsheet where I have a column with some products in them. Each product has a price listed next to it. I have another sheet with sales, and a column has the product sold in the sale. I want a formula that produces the total price of every sale made, and products can be repeated.

Basically, if I have two products, A and B, with prices $1 and $2, then I have 3 sales, two of the sales use product A and one uses product B, the formula should return $4.

I tried using an ARRAYFORMULA with VLOOKUP and LOOKUP but no luck. Any help is appreciated, thanks.

Edit: Here is an example sheet as requested. Feel free to edit it. https://docs.google.com/spreadsheets/d/1obHa6lbxJl_tJlQ811kjJralb7GCGjHtYBkOEPCzxAk/edit?usp=sharing

use:

=ARRAYFORMULA(SUM(IFNA(VLOOKUP(Sales!C2:C, Products!A:B, 2, 0))))

0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM