every other on a nested sumif

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello All,


I know there are ways to count every nth value however, I am struggling to apply it to my current formula. I am trying to do every other cell.(in the 165:178 portions))

Code:
=(SUM(IF(E$165:E$178<$B89,IF(F$165:F$178>$A89,IF(F$165:F$178<$B89,F$165:F$178,$B89)-IF(E$165:E$178>$A89,E$165:E$178,$A89))))*24)

Any guidance would be appreciated!

Thanks,

Andrew
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
First of all, I found your formula a bit tough to decipher, so I rewrote it like so:
Rich (BB code):
=SUMPRODUCT(--(E$165:$E178<$B89),--(F$165:F$178>$A89),IF(F$165:F$178<$B89,F$165:F$178,$B89)-IF(E$165:E$178>$A89,E$165:E$178,$A89))*24
confirmed with Control-Shift-Enter. You should check to see that it does what you want, since I really can't create sample data to test it.

Once you have that, you can try:

Rich (BB code):
=SUMPRODUCT(--(E$165:$E178<$B89),--(F$165:F$178>$A89),MOD(ROW($E$165:$E$178),2)=0,IF(F$165:F$178<$B89,F$165:F$178,$B89)-IF(E$165:E$178>$A89,E$165:E$178,$A89))*24
which will only sum up the even rows. Change the red zero to a 1 to sum the odd rows.
 
Upvote 0
The first formula works (had to fix the 2nd $ though in order to fill the formula down). However the second formula calculates neither even nor odd rows, it just returns a value of zero
 
Upvote 0
Darn, I made a tiny tweak between my test sheet and posting it, and I introduced a glitch. Try it this way:

Rich (BB code):
=SUMPRODUCT(--(E$165:$E178<$B89),--(F$165:F$178>$A89),--(MOD(ROW($E$165:$E$178),2)=0),IF(F$165:F$178<$B89,F$165:F$178,$B89)-IF(E$165:E$178>$A89,E$165:E$178,$A89))*24
 
Upvote 0
Code:
[COLOR=#333333]=SUMPRODUCT(--(E$165:E[/COLOR][COLOR=#ff0000]$[/COLOR][COLOR=#333333]178<$B89),--(F$165:F$178>$A89)[/COLOR],--(M[COLOR=#333333]OD(ROW($E$165:$E$178),2[/COLOR])=0),[COLOR=#333333]IF(F$165:F$178<$B89,F$165:F$178,$B89)-IF(E$165:E$178>$A89,E$165:E$178,$A89))*24[/COLOR]


Works perfect like this! Thank you!
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,535
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top