Domanda

I have some data that I want summed matching certain criteria

Example data:

  A    B   C   D
  Id   Id2 Id3 Val
  1    1   8   6
  1    2   7   7
  1    3   3   8
  1    4   6   4
  1    4   78  7
  1    1   2   9
  1    3   1   4
  1    4   3   6
  1    1   5   8
  1    4   7   2

Now I want the Val summed for every Id, based on certain criteria (e.g. Id2=4 and Id3=2) for every Id which has 100 values, but I want to avoid rerunning the sumifs for every Id since the table is heavy.

What I have been doing so far is to

= SUMIFS(D:D, A:A, "=1", B:B, "=4", C:C, "=2")
= SUMIFS(D:D, A:A, "=2", B:B, "=4", C:C, "=2")
= SUMIFS(D:D, A:A, "=3", B:B, "=4", C:C, "=2")
= SUMIFS(D:D, A:A, "=4", B:B, "=4", C:C, "=2") ... 

(if I remember the syntax of sumifs correctly)

Is there a faster way that avoids rerunning the sumifs for each Id ?

È stato utile?

Soluzione

If you want to figure lots of SUMs in this way, it's best done with a pivot table.

You may also try DSUM, but I doubt it's going to be any faster than SUMIF.

Altri suggerimenti

You could also do an array formula which should also be lightning fast.

So select the range that you want your results, then push F2 to enter where you want your first formula. Then put in the below array formula:

= SUMIFS(D:D, A:A, "="&{1;2;3;4}, B:B, "=4", C:C, "=2")

or

= SUMIFS(D:D, A:A, "="&G1:G4, B:B, "=4", C:C, "=2")

where G1 to G4 have your values you want to iterate over.

This will make it so it only grabs the data only once rather than multiple times and will return all the values one time rather than multiple times.

If you want to iterate from left to right use a comma instead of a semicolon in your array.

When you enter an array formula enter it this way:

Ctrl+Shift+Enter
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top