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
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,728
Office Version
  1. 2016
  2. 2013
  3. 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
19,728
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
So, is the number of columns going to increase over time ?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,672
Messages
5,597,488
Members
414,146
Latest member
marginmakerb

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