[英]Sum across sheets of (if cell x equals get cell y)
Hello there im struggling for how to eplain this in a sentence and thus have been all over the web and thot id best just ask someone. 你好,我正在努力如何在一个句子中解释这个,因此已经遍布网络和thot id最好只是问一个人。
So we have a sales file with daily sales sheets. 所以我们有一个包含每日销售表的销售档案。 what im looking for is a formula that will get all sales for specific salesman from each day and total them.
我正在寻找的是一个公式,它将从每一天获得特定销售员的所有销售额并将其总计。 so it basically has to get the data from Cell C:% if cell I:% = David, for each table on all sheets and give me a total of this so i can say form a table
因此它基本上必须从Cell C获取数据:%if if cell I:%= David,对于所有工作表上的每个表并给我一个总数,所以我可以说形成一个表
Now the sheet already uses macros for data entry so i can use macros, i would ofc prefer a formula to complete this is anyone knows of any? 现在工作表已经使用宏进行数据输入所以我可以使用宏,我会更喜欢一个公式来完成这是任何人都知道的吗?
You can use sumif like this: 您可以像这样使用sumif:
=SUMIF(Sheet1!I:I,"David",Sheet1!C:C)+SUMIF(Sheet2!I:I,"David",Sheet2!C:C)+...
for each sheets, but I would write simple UDF: 对于每张纸,但我会写简单的UDF:
Function SumIF_AllSheets(criteriaRng As Range, criteria, sumRng As Range)
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
SumIF_AllSheets = SumIF_AllSheets + WorksheetFunction.SumIf(ws.Range(criteriaRng.Address), criteria, ws.Range(sumRng.Address))
Next
End Function
and call it like this: SumIF_AllSheets(I:I,"David",C:C)
并称之为:
SumIF_AllSheets(I:I,"David",C:C)
假设sheetlist是列出所有其他工作表名称的命名范围,您可以在复制表的单元格B2中使用此公式,其中A2 down列出销售人员的姓名
=SUMPRODUCT(SUMIF(INDIRECT("'"&sheetlist&"'!I:I"),A2,INDIRECT("'"&sheetlist&"'!C:C")))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.