Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Average of range help


Hello...I'm sure this is easy but i am new to macros...

I am trying to prompt a user with an input box where they will select a
range of values. Those values would then be averaged and placed in a
cell or a msgbox.


Thanks in advance for your help!


--
impius1
------------------------------------------------------------------------
impius1's Profile: http://www.excelforum.com/member.php...o&userid=37671
View this thread: http://www.excelforum.com/showthread...hreadid=572778

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Average of range help


Cant be Done?


--
impius1
------------------------------------------------------------------------
impius1's Profile: http://www.excelforum.com/member.php...o&userid=37671
View this thread: http://www.excelforum.com/showthread...hreadid=572778

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Average of range help

impius,

Sub DoAverage()
Dim myAvg As Double
On Error Resume Next
myAvg = Application.Average(Application.InputBox( _
"Select the range to average", , , , , , , 8))
MsgBox myAvg
Range("A1").Value = myAvg
End Sub


HTH,
Bernie
MS Excel MVP


"impius1" wrote in message
...

Hello...I'm sure this is easy but i am new to macros...

I am trying to prompt a user with an input box where they will select a
range of values. Those values would then be averaged and placed in a
cell or a msgbox.


Thanks in advance for your help!


--
impius1
------------------------------------------------------------------------
impius1's Profile: http://www.excelforum.com/member.php...o&userid=37671
View this thread: http://www.excelforum.com/showthread...hreadid=572778



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Average of range help


Thanks! One more question that may make this quite a bit mor
difficult.

If the user selects a range such as a1:c5, I would like to sum column
of the selected range, then sum column c of the selected range...The
divide the result of the sum of c by the result of sum of b, and the
display final result.

I dont know if that is even possible but thanks for your time

--
impius
-----------------------------------------------------------------------
impius1's Profile: http://www.excelforum.com/member.php...fo&userid=3767
View this thread: http://www.excelforum.com/showthread.php?threadid=57277

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Average of range help

Sub DoAverageV2()
Dim myAvg As Double
Dim myR As Range
On Error Resume Next
Set myR = Application.InputBox( _
"Select the range to average", , , , , , , 8)
If myR.Columns.Count < 3 Then Exit Sub
myAvg = Application.Sum(myR.Columns(3)) / _
Application.Sum(myR.Columns(2))
MsgBox myAvg
Range("A1").Value = myAvg
End Sub

HTH,
Bernie
MS Excel MVP


"impius1" wrote in message
...

Thanks! One more question that may make this quite a bit more
difficult.

If the user selects a range such as a1:c5, I would like to sum column b
of the selected range, then sum column c of the selected range...Then
divide the result of the sum of c by the result of sum of b, and then
display final result.

I dont know if that is even possible but thanks for your time!


--
impius1
------------------------------------------------------------------------
impius1's Profile: http://www.excelforum.com/member.php...o&userid=37671
View this thread: http://www.excelforum.com/showthread...hreadid=572778





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Average of range help


Thanks so much!


--
impius1
------------------------------------------------------------------------
impius1's Profile: http://www.excelforum.com/member.php...o&userid=37671
View this thread: http://www.excelforum.com/showthread...hreadid=572778

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Average of range help

You're welcome!

Bernie
MS Excel MVP

Thanks so much!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AVERAGE a range in a column if another column's range equals a val bob$ Excel Discussion (Misc queries) 3 February 24th 09 07:42 AM
Average if....between range Saintsman Excel Worksheet Functions 4 August 8th 07 11:52 AM
average of the range saziz[_63_] Excel Programming 2 January 19th 06 01:14 AM
Average of a , < range Deb Pingel Excel Worksheet Functions 4 December 22nd 05 12:37 AM
Average Range Stndt Excel Worksheet Functions 0 October 27th 04 06:00 PM


All times are GMT +1. The time now is 10:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"