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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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
 
Upvote 0
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:
Upvote 0
So, is the number of columns going to increase over time ?
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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