Creating mean, median, mode and range calculator in userforms

mr vba

New Member
Joined
Mar 1, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello i
Am trying to create an excel mean median mode and range calculator in userforms

I have set out the form and it looks like this]
pic 1.png

The idea is you select what you want to calculate and enter the range of numbers and it enters the answer in TextBox 2 at the bottom.
pic 2.png

So far haven’t managed to find any formulas and I am not very skilled in vba
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You can use Application.WorksheetFunction.WhichFunction(function sysntax) to exploit within vba the excel functions and get the result...
 
Upvote 0
How can i use that in a code sequence so the function answer goes into the second textbox?
 
Upvote 0
For example, within the CommandButton_Click code:
VBA Code:
If Me.ComboBox1.Value = "Mode" Then
    On Error Resume Next
    Me.TextBox2.Text = Application.WorksheetFunction.Mode(Range(Me.TextBox1.Value))
    On Error GoTo 0
ElseIf Me.ComboBox1.Value = "XYZ" Then
    'your instructions for the function
ElseIf Me.ComboBox1.Value = "ABC" Then
    'your instructions for the function
'etc
'etc
End If
I used "On Error" as a poor man error handling procedure, you'd better check that the parametres for the selected function are properly selected and issue proper error messages to guide the user in the process

Bye
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,755
Members
449,094
Latest member
dsharae57

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