ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Average of last column (https://www.excelbanter.com/excel-discussion-misc-queries/117444-average-last-column.html)

grok

Average of last column
 
pleaseHello all. I've been reading these threads to figure out how to do
what I want but can't quite get there. Here's what I'm trying to do:

I have a worksheet that gets written from an app. After the app stops I
want to open the worksheet and compute the average of the last column (not
including the header row) and place the result one cell below the cell in the
last row, last col no matter how many rows and cols are present.

I think I need a macro which calls a formula which calls a function. Could
someone please provide a solution?

grok

Don Guillett

Average of last column
 
One way

Sub averagelastcolumn()
lc = Cells(1, Columns.Count).End(xlToLeft).Column
lr = Cells(Rows.Count, lc).End(xlUp).Row
Cells(lr + 1, lc) = Application.Average(Range(Cells(2, lc), Cells(lr, lc)))
End Sub

--
Don Guillett
SalesAid Software

"grok" wrote in message
...
pleaseHello all. I've been reading these threads to figure out how to do
what I want but can't quite get there. Here's what I'm trying to do:

I have a worksheet that gets written from an app. After the app stops I
want to open the worksheet and compute the average of the last column (not
including the header row) and place the result one cell below the cell in
the
last row, last col no matter how many rows and cols are present.

I think I need a macro which calls a formula which calls a function.
Could
someone please provide a solution?

grok




grok

Average of last column
 
Works like a charm! Thanks.

"Don Guillett" wrote:

One way

Sub averagelastcolumn()
lc = Cells(1, Columns.Count).End(xlToLeft).Column
lr = Cells(Rows.Count, lc).End(xlUp).Row
Cells(lr + 1, lc) = Application.Average(Range(Cells(2, lc), Cells(lr, lc)))
End Sub

--
Don Guillett
SalesAid Software

"grok" wrote in message
...
pleaseHello all. I've been reading these threads to figure out how to do
what I want but can't quite get there. Here's what I'm trying to do:

I have a worksheet that gets written from an app. After the app stops I
want to open the worksheet and compute the average of the last column (not
including the header row) and place the result one cell below the cell in
the
last row, last col no matter how many rows and cols are present.

I think I need a macro which calls a formula which calls a function.
Could
someone please provide a solution?

grok





Don Guillett

Average of last column
 
glad to help


--
Don Guillett
SalesAid Software

"grok" wrote in message
...
Works like a charm! Thanks.

"Don Guillett" wrote:

One way

Sub averagelastcolumn()
lc = Cells(1, Columns.Count).End(xlToLeft).Column
lr = Cells(Rows.Count, lc).End(xlUp).Row
Cells(lr + 1, lc) = Application.Average(Range(Cells(2, lc), Cells(lr,
lc)))
End Sub

--
Don Guillett
SalesAid Software

"grok" wrote in message
...
pleaseHello all. I've been reading these threads to figure out how to
do
what I want but can't quite get there. Here's what I'm trying to do:

I have a worksheet that gets written from an app. After the app stops
I
want to open the worksheet and compute the average of the last column
(not
including the header row) and place the result one cell below the cell
in
the
last row, last col no matter how many rows and cols are present.

I think I need a macro which calls a formula which calls a function.
Could
someone please provide a solution?

grok








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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com