Question

Statistics Macro Assignment

Write a macro to find the number of observations, max, min, sum, average and standard deviation for a column of numbers with any number of observations starting in cell A1 and proceeding downward. The number set will be of any length and include negative, zero, and positive integers. Display the results as shown below. Use the numbers below as an example.

You may use the key board code “Selection.End(xlDown).Select” if you wish. Otherwise, use only VBA code to accomplish these tasks. No Excel functions may to be used in the spreadsheet. Name the Excel file “Statistics”, name macro “Statistics” and create a “RUN” button on the spreadsheet. Remember to dimension all variables. The macro will be graded using a different data set.

Count 22.00 Max-9.00 Min -6.00 1 Sum-64.00 Avg. -2.91 4.26 Descriptive Statistics Std. Dev. 2 10 12 13 15 16 17 18 19 20 1

As simple as possible please

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Macro Code:

Sub Statistics()

MsgBox ("Success Statistics Report")
Dim r As Range, sum As Integer, average As Double, count As Integer, Max As Integer, Min As Integer


Set r = Sheets("Sheet1").Range("A:A")
sum = Application.WorksheetFunction.sum(r)
average = Application.WorksheetFunction.average(r)
count = Application.WorksheetFunction.count(r)
Max = Application.WorksheetFunction.Max(r)
Min = Application.WorksheetFunction.Min(r)
sd = Application.WorksheetFunction.StDev(r)
  

Worksheets(1).Range("G3").Value = count
Worksheets(1).Range("G6").Value = sum
Worksheets(1).Range("G7").Value = average
Worksheets(1).Range("G4").Value = Max
Worksheets(1).Range("G5").Value = Min
Worksheets(1).Range("G8").Value = sd

End Sub

Output picture:

Statistics -Excel FILE HOME INSERT PAGE LAYOUT FORMULAS DATA REVIEW VIEW DEVELOPER AutoSum A Cut Calibri 11A A fg Copy . ·ク·A

Microsoft Visual Basic for Applications- Statistics.xdsx - [Modulel (Code)] File Edit View Insert Format Debug Bun Tools Add-

Please give a thumbs up......

Add a comment
Know the answer?
Add Answer to:
Statistics Macro Assignment Write a macro to find the number of observations, max, min, sum, aver...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assignment • No variables declared after you start writing code, must be declared at the top....

    Assignment • No variables declared after you start writing code, must be declared at the top. • Reuse all the variables from the first half in the second half, do not make up new variable names. • You code must be properly formatted. • You must use the code provided and variables names provided and not add any more variables to your code. • No for(int I = 0; … no declaring variables except at top of code. • You...

  • Please program in C++ and document the code as you go so I can understand what...

    Please program in C++ and document the code as you go so I can understand what you did for example ///This code does~ Your help is super appreciated. Ill make sure to like and review to however the best answer needs. Overview You will revisit the program that you wrote for Assignment 2 and add functionality that you developed in Assignment 3. Some additional functionality will be added to better the reporting of the students’ scores. There will be 11...

  • Copy the following java codes and compile //// HighArray.java //// HighArrayApp.java Study carefully the design and...

    Copy the following java codes and compile //// HighArray.java //// HighArrayApp.java Study carefully the design and implementation HighArray class and note the attributes and its methods.    Create findAll method which uses linear search algorithm to return all number of occurrences of specified element. /** * find an element from array and returns all number of occurrences of the specified element, returns 0 if the element does not exit. * * @param foundElement   Element to be found */ int findAll(int...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT