SUM(IF greater/equal every other row

Defaced

New Member
Joined
Nov 19, 2015
Messages
26
Hopefully I will explain this well enough to understand outside my brain. I have 2 columns of shift times (Shift Start and Shift End) all on the even rows. Under their shifts is the row that has their Lunch break start/end times. I need to get an interval count of the number of people staffed, but when I used:

{=SUM(IF($A3>=$B$3:$B$100,IF($A3<$C$3:$C$100,1,0),0))}

It includes the lunch shifts and makes my counts inaccurate. Does anyone know of a way to only sum the even rows (shifts) and subtract the even rows (lunches) to get a true count?
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Do you have any key values in another column that could indicate which rows are Shift times, and which are Lunch times ?
So you could say sum this if column A equals "shift" ?
 
Upvote 0
No they don't, just the two columns that have Start/End times:

StartEnd
MSR A8:004:30
Lunch12:0012:30

<colgroup><col width="64" style="width:48pt"> <col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>

Similar to that with MSR A and Lunch in column A, Start in Column B and End in Column C. MSR A is Row 2 and Lunch is Row 3.
 
Upvote 0
Is that what it looks like in your book? That sure looks like column A could be used as a criteria, sum the ones that don't = Lunch.
 
Upvote 0
What I have is a sheet that has a list of 30 minute intervals:

6:00 AM
6:30 AM
7:00 AM
7:30 AM


<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>
And so forth, that is all in column A (Summary Tab). The data in the previous comment (Start End) is on other tabs and I am trying to get a count of how many people I would have staffed at 6:00 AM based on their Start time, but I do not want it to include any lunches that are listed as 6:00 AM. So If I had 3 people that start at 6:00 AM and 1 person lunch at 6:00 AM, the total should be 2 and not 4.
 
Upvote 0
Just based on the original formula, to check EVEN rows

=SUM(IF($A3>=$B$3:$B$100,IF($A3<$C$3:$C$100,IF(ISEVEN(ROW($B$3:$B$100)),1,0),0),0))
 
Upvote 0
It's still not showing correctly for lunches. This is what I am trying to get and will use a short example. I have a schedule and lunch that looks like this:

BC
6:00 AM2:30 PM
11:00 AM11:30 AM

<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>

Start time is column B, end time is column C. Since this person is working 6-2:30, everything next to the time should have a 1 except the 11:00 cell on the Summary Tab:

AB
6:00 AM1
6:30 AM1
7:00 AM1
7:30 AM1
8:00 AM1
8:30 AM1
9:00 AM1
9:30 AM1
10:00 AM1
10:30 AM1
11:00 AM0
11:30 AM1
12:00 PM1
12:30 PM1
1:00 PM1
1:30 PM1
2:00 PM1

<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>

With the formula you provided it has a 1 next to everything from 6-2:00
 
Upvote 0
It's covering 2 different sheets?

You need to reference the sheet names.
On the Summary sheet, use the formula like this and reference the sheet with the schedules (you didn't say the name of that Sheet, I'm guessing Schedule)

=SUM(IF($A3>=Schedule!$B$3:$B$100,IF($A3 < Schedule!$C$3:$C$100,IF(ISEVEN(ROW(Schedule!$B$3:$B$100)),1,0),0),0))
 
Last edited:
Upvote 0
That's exactly what I had and it's still counting the lunch at 11:00. Is there a way with that formula to subtract using ISODD? This way it will read the 11:00 lunch and subtract it so that cell will show as a 0 instead of a 1.
 
Upvote 0

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

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