LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro to find last row with Data, avg last 30, show result on row

Hi,
I've been attempting to write a macro to do this and received prior feedback.

First response was I did not need a macro, I can use the formula:

=IF(COUNT(A10:A1010),AVERAGE(A1010:INDEX(A10:A1010 ,INDEX(LARGE((A10:A1010<"")*ROW(A10:A1010),31),0) )),0)

Even though this works, I can't make heads or tails of this.
When I try to break this down into smaller functions, it falls apart
What is going on by multiplying ((A10:A1010<")*Row(A10:1010),31)0)
Using Nested indexes?
What does A1010<"" mean?

What are some rules for cell references? How do I make a cell reference a
variable?

Can somone please dicipher this... for me?

Also, what if the number of data points collected has not reached 30 yet?
Will this function fail? It does not appear to be failing when I test it
with just 3 values, but I dont' really understand specifically what the
function is doing.
__________________________________________________ __________________
The second response was a macro.

Sub Math()
Dim lastRow As Long
Dim sh As Worksheet

For Each sh In Worksheets
sh.Activate

With sh

lastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
..Cells(lastRow, "B").FormulaR1C1 _
= "=average(r[-1]c:r[-30]c)"

End With
Next sh

End Sub

__________________________________________________ __________________
There are a few things that I would like it to do differently. I want the
macro to (starting from Row 12) find the last row and then average the last
30 entities, and post the result on Row 10.

I only need to run the macro on a specific worksheet, not multiple sheets.

I want to start the macro running once I get 30 sets of data

Also, data is recorded in column's A:AZ, and I have to perform this function
on every column throughout the entire spectrum.

Every so often, I hit a button to copy and paste special the values to
another spreadsheet, so this macro has to continue to run while I run another
macro at random intervals.

I would like to increase my data field from 1200 points to 12,000 points so
I can run my test for anywhere from 1 hour (data collected every 3 seconds)
to 10 hours
__________________________________________________ __________________
Also, in the statement "=average(r[-1]c:r[-30]c)", is there a way to replace
the -1 and -30 with counters to represent the row index number like "x" and
"y", where "X"=50 and "y" =80.

How do I get the macro to put the answer in a specific Row that I activate
versus
..Cells(lastRow,"A"). I want the answer to be displayed on Cells("A12")


 
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
Searching multiple data to show desired result lawandgrace Excel Discussion (Misc queries) 3 September 1st 09 05:06 AM
how do I write a macro to show the find dialog box in excel 2003 evets Excel Discussion (Misc queries) 1 July 6th 08 01:11 PM
Advanced formula - Return result & Show Cell Reference of result Irv Excel Worksheet Functions 7 May 6th 06 03:36 AM
How identify data of two coulams,Every cell count and show result pooja Excel Discussion (Misc queries) 1 September 19th 05 09:51 AM
I need to find a macro to find data cut and paste to another colu. Rex Excel Programming 6 December 7th 04 09:22 AM


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

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

About Us

"It's about Microsoft Excel"