Count the number of blank cells in a range, starting and ending will cells that match string values

JaredXIII

New Member
Joined
May 13, 2013
Messages
5
Greetings MrExcel forum! First time poster here, reaching out because I'm getting desperate to determine if there is a solution to my problem.

I'm trying to develop a new daily timesheet for my production workers, where non-production items are recorded in 15 minute intervals. The user would put in "Clock in" by the corresponding time, and the same for "Clock out" at the end of the day. Any non-production items will be type in next to their appropriate time. Since clock in and clock out times will vary, I need to set up a formula that searches the array of cells for the day, finds the "Clock in" and "Clock out" values, and counts any blank cells in between them. Basically the blank cells will equal production time, and the result of the Count function will be multiplied by 0.25 to get the hours.

I am having a very difficult time finding a way to set the "Clock in" and "Clock out" cells as the range for the Count function, because it won't always be the same cells. What would be the best way to automatically have excel find the cells containing these values and set them as the range criteria for a Count function?

JnKqyCD.png


The formula at the bottom was one of my initial attempts, but it didn't work. I took out the '=' for the screenshot, so that wasn't the problem. :stickouttounge:

Thanks so much for your help!!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi,

try this

=COUNTBLANK(INDIRECT(ADDRESS(MATCH("Clock In",B:B,0),2)):INDIRECT(ADDRESS(MATCH("Clock out",B:B,0),2)))
 
Upvote 0
Excellent! This worked perfectly; all I had to do was add 1 to the count, since it won't count the "Clock in" cell as production time (I knew this would happen,though), and multiply the total by 0.25

=((COUNTBLANK(INDIRECT(ADDRESS(MATCH("Clock In",B:B,0),2)):INDIRECT(ADDRESS(MATCH("Clock out",B:B,0),2)))+1)*0.25) Gives me a correct count of 7.

Thanks so much for the fast response, you are awesome! :biggrin:
 
Upvote 0
=(COUNTBLANK(INDEX(B:B,MATCH("Clock In",B:B,0)):INDEX(B:B,MATCH("Clock Out",B:B,0)))+1)*0.25
 
Upvote 0
This worked perfectly, also, and it gives me some insight on different ways of getting this done. Thanks very much for taking the time to reply!
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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