vba calculations
Microsoft Office Training verified by visa - mastercard securecode about microsoft training company london ukadd this page to your favourites/bookmarksAdd to favourites
view a printable version of this pagePrintable version
email this page to somebodyEmail this page
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and Help » VBA Calculations

VBA Calculations

The UK's most regular instructor-led training courses.
Training information: training courses in excel · Excel courses · VBA training in London

resolvedResolved · Urgent Priority · Version 2003

VBA Calculations

James has attended:
Excel Advanced course
Excel VBA course
Excel VBA Advanced course

by - delegate James [4 posts] (2008 Aug 8 Fri, 11:24) replyReply

I have a row of numbers and I want to calculate the average and standard deviation of these numbers using the excel functions within a macro. I don't want to output the results, I need it for a loop within the macro.

What is the code for this type of operation?

Thanks,

James

0788 1546 946

Excel Advanced 1 day course
Version Date Location Places
available
Book Next place rate:
Card Invoice
2007 2008 Nov 27 Thu Bloomsbury 4 book now £240 £245
2003 2008 Nov 28 Fri Southwark 1 book now £235 £240
2003 2008 Dec 3 Wed Bloomsbury 1 book now £235 £240
2003 2008 Dec 5 Fri Bayswater 6 book now £195 £205
2002/XP 2008 Dec 10 Wed Tooting 0 FULL    
2003 2008 Dec 10 Wed Bloomsbury 0 FULL    
Full Schedule: See all 98 Excel Advanced course dates.
Bookings currently available until 24th November 2009.

RE: VBA Calculations

by - trainer Amanda diamond contributer[1210 posts] (2008 Aug 8 Fri, 11:57) replyReply

Hello James

Thank you for your post.

We do not have any VBA trainers available currently to assist with your request as they are all training today.

I can refer your question to a VBA trainer for review, however you may not receive a response until sometime next week.

Amanda

RE: VBA Calculations

by - trainer Stephen gold contributer[369 posts] (2008 Aug 12 Tue, 09:16) replyReply

Hi James

Thank you for your question

The following code will solve your problem for you

Sub ElemStats()

Dim dblMean As Double
Dim dblStDEv As Double


dblMean = Application.WorksheetFunction.Average(Range("b2:e2"))

MsgBox dblMean

dblStDEv = Application.WorksheetFunction.StDev(Range("b2:e2"))

MsgBox dblStDEv

End Sub


The critical lines of code use the worksheet function method of the application object to calculate the arithmentic mean and the standard deviation of a row of numbers in the range "b2:e2".

I have used msgboxes to output the results, but this is obviously not essential and you can just manipulate the variables as you wish

Regards

Stephen


Related articles

· Database Tips from an Excel Training Course
· Compare Different MS Excel Training Methods
· Tap the Power of Recorded Macros with MS Excel Courses
· Customized Financial Excel Courses in London
· Excel Advanced Courses Ease the Frustration of Learning Complex Tasks

Please browse our web site to find out more about
training courses in excel and other Microsoft training courses.

Excel tip:

Generating simple column charts

1.Select cell range containing data/figures
2. Press F11

View all Excel hints and tips

Institute of IT Training - Accredited Training Provider Microsoft Certified Partner
microsoft office
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider Association of Computer Trainers Valid HTML 4.01 Transitional
Valid CSS Markup

secure online payments - visa - mastercard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Training by application Main information pages See also

Access courses
DreamWeaver courses
Excel courses
MS Project courses
Outlook courses
PowerPoint courses
VBA courses
Word courses
(more...)

Public scheduled courses
On-site training
Closed company courses

Microsoft Office training
Pricing and availability
Training schedule
Training venues

Access training
Dreamweaver training
Excel training
MS Project training
PowerPoint training

London Computer Training
Computer Training London

Microsoft Access training
Microsoft Excel training
Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training

Time Management Course London

Interested in Access training? Please see the following pages:
microsoft access courses · microsoft training access course
microsoft+access+training · access courses in london

Training Information

Training Articles

AddThis Social Bookmark Button What's this?
Add to Del.icio.us Add to Facebook Add to Digg Add to Reddit Add to Google Add to Yahoo Add to Diigo Add to Mr. Wong Add to Linkarena Add to Power Oldie Add to Folkd Add to Jumptags Add to Upchuckr Add to Simpy Add to StumbleUpon Add to Slashdot Add to Netscape Add to Furl Add to Spurl Add to Blinklist Add to Blogmarks Add to Technorati Add to Newsvine Add to Blinkbits Add to Ma.Gnolia Add to Smarking Add to Netvouz