VBA excel; Calculate the % utilisation

Lewisbwalsh

New Member
Joined
Feb 9, 2016
Messages
1
Hi i am stuck on this question for my application programming class in excel,


  1. Calculate the % utilisation for the whole timetable. Utilisation is the percentage of empties.
  2. You can use Find with blanks (nothing) but make sure to select the timetable range first so that you do not find blanks outside of that
I have been given a workbook.
Can someone please help or to even get it started.
Thank you
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hello,

I'm not sure of the structure of your workbook. So i mocked up the timetable below.
8vzp5e.jpg



There are a number of ways to achieve the same result i'm sure. The rudimentary VBA code structure i would use would be this:
Code:
Sub Utilisation()


Dim oData As Range
Dim oCells As Range
Dim eCount As Integer 'Counts how many blanks in the range
Dim tCount As Integer 'Counts total cells in range


'Set the range of the timetable (excluding headers)
Set oData = ActiveSheet.Range("B2", "H8")
'Initialise counters
eCount = 0
tCount = 0


For Each oCells In oData
    If oCells.Value = "" Then
        eCount = eCount + 1
        tCount = tCount + 1
    Else
        tCount = tCount + 1
    End If
Next oCells


MsgBox "Number of Empty Cells : " & eCount
MsgBox "Total Number of Cells : " & tCount


'Insert your calculation for utilisation here, using eCount and tCount


End Sub

Hope that Helps
Caleeco
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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