简体   繁体   中英

Excel: How to find a certain row and multiply the values in that row by a certain number?

I'm trying to find a specific row by checking its unique code and multiply all the values in that row by its weight. Please see the example below.

 A      B       C       D       E          F       G
 code   weight  code    price   quantity   new_p   new_q  
 A11    0.1     A11     10      5          1       0.5
 A12    0.2     A12     4       3          0.8     0.6
 A11    0.3     A13     2       9          3       1.5
 A14    0.2     A14     4       16         0.8     3.2
 A12    0.4                                1.6     1.2
 A11    0.8                                8       4  

In the above example, my goal is to get the values in column F and G. You can see AB and CE as two separate spreadsheet: Basically, for each row in A, I look for its corresponding original price and quantity from D and E and then multiply the values in D & E by its unique weight from B, which will result in a new price and a new quantity.

I have been using sumproduct, but is there any smarter way of doing this?

Put this in F2 and copy over one and down the data set:

=$B2*VLOOKUP($A2,$C:$E,COLUMN(B1),FALSE)

在此处输入图片说明

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