ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Summing 2 columns based on variables (https://www.excelbanter.com/excel-worksheet-functions/260910-summing-2-columns-based-variables.html)

Steve

Summing 2 columns based on variables
 
This replicates through hundreds of rows.
I need the total hours scheduled by day based on the 0 or 1s in the cloumns
, and the # of variable hours in the z column.
In the following, in cell S2, I need a formula to look at S5, if it's a
zero, then 0, if it's a 1, then add whatever is in the z column ( in this
case an 8), then to add up all the S column cells based on if there' a 1 in
that column, then whatever the Z column shows. In this scenario, cell S1
would have 18, because 1's are in 7,8 &9 -SUM(Z7:Z9). And U2 would have 24,
because 1's are in 5,6,& 8, - Z5+Z6+Z8, etc.

s t u v w x y
z
4 Sat Sun Mon Tue Wed Thu Fri hrs
5 0 0 1 1 1 1 1 8
6 0 0 1 1 1 1 1 8
7 1 0 0 1 1 1 1 5
8 1 1 1 1 1 0 0 8
9 1 1 0 0 1 1 1 5

18 13 24 29 34 26 26

Much thanks,

Steve

Luke M[_4_]

Summing 2 columns based on variables
 
=SUMPRODUCT(S5:S9,$Z5:$Z9)

--
Best Regards,

Luke M
"Steve" wrote in message
...
This replicates through hundreds of rows.
I need the total hours scheduled by day based on the 0 or 1s in the
cloumns
, and the # of variable hours in the z column.
In the following, in cell S2, I need a formula to look at S5, if it's a
zero, then 0, if it's a 1, then add whatever is in the z column ( in this
case an 8), then to add up all the S column cells based on if there' a 1
in
that column, then whatever the Z column shows. In this scenario, cell S1
would have 18, because 1's are in 7,8 &9 -SUM(Z7:Z9). And U2 would have
24,
because 1's are in 5,6,& 8, - Z5+Z6+Z8, etc.

s t u v w x y
z
4 Sat Sun Mon Tue Wed Thu Fri hrs
5 0 0 1 1 1 1 1 8
6 0 0 1 1 1 1 1 8
7 1 0 0 1 1 1 1 5
8 1 1 1 1 1 0 0 8
9 1 1 0 0 1 1 1 5

18 13 24 29 34 26 26

Much thanks,

Steve




Steve

Summing 2 columns based on variables
 
Perfect. Much thanks. I didn't expect it to be that simple.

Thanks again,

Steve

"Luke M" wrote:

=SUMPRODUCT(S5:S9,$Z5:$Z9)

--
Best Regards,

Luke M
"Steve" wrote in message
...
This replicates through hundreds of rows.
I need the total hours scheduled by day based on the 0 or 1s in the
cloumns
, and the # of variable hours in the z column.
In the following, in cell S2, I need a formula to look at S5, if it's a
zero, then 0, if it's a 1, then add whatever is in the z column ( in this
case an 8), then to add up all the S column cells based on if there' a 1
in
that column, then whatever the Z column shows. In this scenario, cell S1
would have 18, because 1's are in 7,8 &9 -SUM(Z7:Z9). And U2 would have
24,
because 1's are in 5,6,& 8, - Z5+Z6+Z8, etc.

s t u v w x y
z
4 Sat Sun Mon Tue Wed Thu Fri hrs
5 0 0 1 1 1 1 1 8
6 0 0 1 1 1 1 1 8
7 1 0 0 1 1 1 1 5
8 1 1 1 1 1 0 0 8
9 1 1 0 0 1 1 1 5

18 13 24 29 34 26 26

Much thanks,

Steve



.


Luke M[_4_]

Summing 2 columns based on variables
 
Your welcome. It helped having a nice setup on your part.

--
Best Regards,

Luke M
"Steve" wrote in message
...
Perfect. Much thanks. I didn't expect it to be that simple.

Thanks again,

Steve

"Luke M" wrote:

=SUMPRODUCT(S5:S9,$Z5:$Z9)

--
Best Regards,

Luke M
"Steve" wrote in message
...
This replicates through hundreds of rows.
I need the total hours scheduled by day based on the 0 or 1s in the
cloumns
, and the # of variable hours in the z column.
In the following, in cell S2, I need a formula to look at S5, if it's a
zero, then 0, if it's a 1, then add whatever is in the z column ( in
this
case an 8), then to add up all the S column cells based on if there' a
1
in
that column, then whatever the Z column shows. In this scenario, cell
S1
would have 18, because 1's are in 7,8 &9 -SUM(Z7:Z9). And U2 would have
24,
because 1's are in 5,6,& 8, - Z5+Z6+Z8, etc.

s t u v w x y
z
4 Sat Sun Mon Tue Wed Thu Fri hrs
5 0 0 1 1 1 1 1 8
6 0 0 1 1 1 1 1 8
7 1 0 0 1 1 1 1 5
8 1 1 1 1 1 0 0 8
9 1 1 0 0 1 1 1 5

18 13 24 29 34 26 26

Much thanks,

Steve



.





All times are GMT +1. The time now is 10:33 PM.

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