ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   sum grouping (https://www.excelbanter.com/excel-discussion-misc-queries/226636-sum-grouping.html)

KLock

sum grouping
 
If I have the following entries
Reason Time
Reason1 50
Reason3 45
Reason3 40
Reason2 35
Reason1 65

What function will give me the output?
Reason total time
Reason1 115
Reason2 35
Reason3 80

A pivot table would not work for me as I am trying to sum tables from
different tabs. Thank you for any help.

Alan

sum grouping
 
With the data in A1:5 and B1:5

=SUMPRODUCT(--($A$1:$A$5=A1),--($B$1:$B$5))

Drag it down to the end of the data list,
Regards,
Alan.
"KLock" wrote in message
...
If I have the following entries
Reason Time
Reason1 50
Reason3 45
Reason3 40
Reason2 35
Reason1 65

What function will give me the output?
Reason total time
Reason1 115
Reason2 35
Reason3 80

A pivot table would not work for me as I am trying to sum tables from
different tabs. Thank you for any help.



KLock

sum grouping
 
Alan,

I was thinking along the lines of sumproduct. Just to better understand
what does the "--" do?

"Alan" wrote:

With the data in A1:5 and B1:5

=SUMPRODUCT(--($A$1:$A$5=A1),--($B$1:$B$5))

Drag it down to the end of the data list,
Regards,
Alan.
"KLock" wrote in message
...
If I have the following entries
Reason Time
Reason1 50
Reason3 45
Reason3 40
Reason2 35
Reason1 65

What function will give me the output?
Reason total time
Reason1 115
Reason2 35
Reason3 80

A pivot table would not work for me as I am trying to sum tables from
different tabs. Thank you for any help.




John[_22_]

sum grouping
 
Hi KLock
You could also use this : =SUMIF(A2:A6,"=Reason1",B2:B6) adjust range to your
needs.
HTH
John
"KLock" wrote in message
...
If I have the following entries
Reason Time
Reason1 50
Reason3 45
Reason3 40
Reason2 35
Reason1 65

What function will give me the output?
Reason total time
Reason1 115
Reason2 35
Reason3 80

A pivot table would not work for me as I am trying to sum tables from
different tabs. Thank you for any help.



John[_22_]

sum grouping
 
Hi KLock
The -- is called a Double Unary, it changes trues and falses
to 1's and 0's. Logic expression to numeric expression.
HTH
John
"John" wrote in message
...
Hi KLock
You could also use this : =SUMIF(A2:A6,"=Reason1",B2:B6) adjust range to your
needs.
HTH
John
"KLock" wrote in message
...
If I have the following entries
Reason Time
Reason1 50
Reason3 45
Reason3 40
Reason2 35
Reason1 65

What function will give me the output?
Reason total time
Reason1 115
Reason2 35
Reason3 80

A pivot table would not work for me as I am trying to sum tables from
different tabs. Thank you for any help.





All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com