可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I have a last_name, first_name, salary, and total_salary columns. The sales person appears multiple times throughout the spread sheet. What I would like to do is write a function that will sum up the salary column in the total_salary column only where the sales person appears.
Example output:
Desired output:
Thanks
回答1:
Try this (assuming your data is in columns A:C
starting row 1):
=SUMPRODUCT(--(A1=A:A),--(B1=B:B),C:C)
Autofit down the list as required.
回答2:
Use the SumIfs
function.
Suppose your data starts in cell A1
You Would have:
A B C D Brian Adam 3000 =SUMIFS($C$1:$C$8,$A$1:$A$8,A1,$B$1:$B$8,B1)
And then just drag down column D
Obviously change the $8
part of the function to the correct number of rows for the sheet.
回答3:
Make your fname
, lname
and sal
columns named ranges
use this formula where ever you want.
=SUMIFS(Sal,Fname,"Brian",Lname,"Adam")
or
=SUMIFS(Sal,Fname,"A2",Lname,"B2")
You can replace"Brian"
and "Adam"
with range references too.
I case you are not familiar: Making a named range
editing a named range