Excel 2007 counting across rows to the next blank cell

KJ2607

New Member
Joined
Aug 28, 2013
Messages
36
Hi There,

I'm looking at writing a formula to count the number of days worked since an employees last day off (results to appear in E7)

From how my spreadsheet is designed, I'm needing to count the number of start/finish cells in Row 7 (F7:G7,J7:K7, and so on) until I get to a blank start/finish cell (and then I'm assuming I'll need to divide by 2 at the end of the formula to get my total number of days) I then need to start counting again once the spreadsheet is update till the next blank cell.

Is this possible? I'm only recently delving into the more complicated formula so any advice/suggestions would be appreciated


<colgroup><col span="2"><col><col><col span="2"><col><col><col span="2"><col><col><col span="2"><col><col><col span="2"><col><col><col span="2"><col><col><col span="2"><col><col></colgroup><tbody></tbody>
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi Andrew,

I can seem to attach my actual spread sheet so I've create a mock of what I'm hoping to try:

ABCDEFGHIJK
1NameTotal Days Since Last Day OffShift 1 StartShift 1 FinishShift 1 StartShift 2 FinishShift 3 StartShift 3 FinishShift 4 StartShift 4 FinishShift 5 Start
2J Smith 08:0017:0008:0017:00 08:0017:00
3
4

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

So what I want to work out is how many days have passed since the employee had a day off, so J Smith in A2 worked 2 days before having a day off (G2:H2 are blank), but then worked another day before having a day off in K2.

I'm hoping for the answer to be entered into B2 every time the spreadsheet is updated - does this make sense?
 
Upvote 0
So for now the result in B2 would be "1" as the employee worked Shift 4 (I2:I3:) My actual spreadsheet goes on for a number of columns as it contains several weeks worth of Employee shifts - If I can understand how to write a formula for the above mock spreadsheet I should be able to adapt it for my actual spreadsheet containing the real data

Is there any way I can upload my actual spreadsheet as that may give a better understanding?
 
Upvote 0
With you sample data the last day off is Shift 5 not Shift 3. If your data ends in column J:

=COUNTIF(INDEX(C2:J2,MAX(INDEX((C2:J2="")*(COLUMN(C2:J2)-COLUMN(C2)+1),))+1):J2,">0")/2

returns 1.
 
Upvote 0
That's Great Thanks Andrew!

I think I definitely need to read up more on this type of formula! :)

Thanks once again
 
Upvote 0

Forum statistics

Threads
1,215,003
Messages
6,122,655
Members
449,091
Latest member
peppernaut

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