avergae formula for defining range. please help me

rvkcools

Board Regular
Joined
Mar 14, 2013
Messages
78
Please help me

I want to write a average function from my activecell...

Range starts from activecell.offset (0, 2) to last right cell data.

Please help me .. thank you
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,275
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
Maybe, assuming your average is in row 1
Code:
Sub MM1()
Dim lc As Integer, x As Double
lc = Cells(1, Columns.Count).End(xlToLeft).Column 'change the row number to the row you need instead of 1
x = Application.WorksheetFunction.Average(Range(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, lc)))
MsgBox x
End Sub
 

rvkcools

Board Regular
Joined
Mar 14, 2013
Messages
78
Maybe, assuming your average is in row 1
Code:
Sub MM1()
Dim lc As Integer, x As Double
lc = Cells(1, Columns.Count).End(xlToLeft).Column 'change the row number to the row you need instead of 1
x = Application.WorksheetFunction.Average(Range(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, lc)))
MsgBox x
End Sub

this is my data in a sheet

b-column c-colum d e f g h i j k
Associate Name
Client Name YTD
W1W2W3
John9100.00%100.00%100.00%
Edwin123.21%100.00%
Lewis120.59%100.00%
David114.72%100.00%
roger110.57%100.00%100.00%
edwin95.44%100.00%100.00%

<tbody>
</tbody>

in "d" column(YTD).... i want to use "average" for wk1 to current week..... my current changes based on the week data...please help me and employee name might increase or decrease so it should run do until employee data is blank.....

note after "d" coulmn, "e" column is blank...Please help me
 
Last edited:

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,275
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
So, is the number of columns going to increase over time ?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,881
Messages
5,834,226
Members
430,267
Latest member
Excel_User_4

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
Top