Excel DSUM with multiple criteria

2019-07-17 02:44发布

I'm pretty new to Excel. Here is the code

=DSUM(Table_1,"column1",INDIRECT(INDIRECT(ADDRESS(MATCH($C9,Names!B:B,0), 1, 1, , "Names"))))

which sums up all the values of column1 inside Table_1 with the matched criteria. However, if I would like to add another criteria say Table1_column_amount=1 to the DSUM, how would I possibly do that?

any help would be appreciated.

标签: excel
1条回答
做自己的国王
2楼-- · 2019-07-17 03:06

So in your setup, you have two tables:

  1. Table_1, the data source.
  2. Table on the Names sheet:
    • Column A: Address of the criteria range, stored as a string in the cell
    • Column B: A name to lookup

You lookup a cell in the Names table and dereference it to get the address of the criteria range.


First of all, it's good to get rid of the inner indirect/address pair, it is not required:

=DSUM(Table_1,"column1",INDIRECT(INDEX(Names!A:A,MATCH($C9,Names!B:B,0),1)))

(Just for the sake of it, it's more readable and much faster to execute.)


Now, to the question.
You have to add the condition to the cell range which is pointed from the cell returned by the INDEX. You have to add a column to it, provide your new condition, and amend the stored reference so that it points to the new, extended range.

You cannot just add up to that condition range by using the range union operator. Unfortunately, the D* set of functions require the condition range to be one single area.

查看更多
登录 后发表回答