Average calculations within userform

coldsteel2177

New Member
Joined
Aug 14, 2018
Messages
1
I am working a a data entry user form that needs to calculate the Days shift Data and the night shift data to create an average. I have 20 averages that needs to be calculated and i have a button set up to execute the averaging function.

Currently the code i am using for the averaging is as follows:
Me.TextBox68.Value = WorksheetFunction.Average(Me.TextBox4.Value, Me.TextBox5.Value)

This works just fine if there is data on both shifts. the issue i am having is that some days there is no data for a certain shift which means one of the two text-boxes being averaged is blank which causes an error. How do i get this to ignore blank boxes.

Any help would be greatly appreciated.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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