Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 17
Default Only the last rows...

I have a spreadsheet with about 50 rows that gradually will be filled up with
numbers. How can I make formula that will count and ad up only the 12 last
rows at any given time? The position of the last 12 rows will here obviously
change over time, since more numbers will be added frequently.

Thanks very much for any help.


--
Lars
--
Lars
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,089
Default Only the last rows...

Lars

one way, assuming no header row:

=IF(ISERROR(OFFSET(A1,COUNTA(A:A)-12,)),"not enough
rows",SUM(OFFSET(A1,COUNTA(A:A)-12,):OFFSET(A1,COUNTA(A:A),)))

This also assumes the data is in column A

Regards

Trevor


"Lars" wrote in message
...
I have a spreadsheet with about 50 rows that gradually will be filled up
with
numbers. How can I make formula that will count and ad up only the 12 last
rows at any given time? The position of the last 12 rows will here
obviously
change over time, since more numbers will be added frequently.

Thanks very much for any help.


--
Lars
--
Lars



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 698
Default Only the last rows...

Trevor is 'da man!!

I tried formula and I ain't even close. Did a code but I think it lacks a
bunch if you have 50 columns, how clunky if you have to adapt this to 50
columns. Simple on one column... Some MVP's can loop this through 50
columns nicely but I can't.

On the worksheet you enter =Sum(Data)

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 1 Then Exit Sub

Dim i As Integer
i = Range("A1").End(xlDown).Row - 1

If Target.Row < 12 Then
Range("A1").End(xlDown). _
Offset(-i, 0). _
Resize(i + 1, 1). _
Name = "Data"
ElseIf Target.Row 12 Then
Range("A100").End(xlUp). _
Offset(-11, 0). _
Resize(12, 1). _
Name = "Data"
End If
End Sub

HTH
Regards,
Howard

"Lars" wrote in message
...
I have a spreadsheet with about 50 rows that gradually will be filled up
with
numbers. How can I make formula that will count and ad up only the 12 last
rows at any given time? The position of the last 12 rows will here
obviously
change over time, since more numbers will be added frequently.

Thanks very much for any help.


--
Lars
--
Lars



Reply
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
Copy rows of data (eliminating blank rows) from fixed layout Sweepea Excel Discussion (Misc queries) 1 March 13th 07 11:05 PM
Get number of rows that data takes up, including blank rows Denham Coote Excel Worksheet Functions 2 August 21st 06 09:18 AM
Excel 2003 -Rows hidden. Scrolling unhides rows ! How do I stop th Excellent1975 Excel Discussion (Misc queries) 0 June 21st 06 08:01 PM
Print few rows with many colums so that rows wrap on printed pages usfgradstudent31 Excel Discussion (Misc queries) 1 October 20th 05 02:39 PM
Pivot Tables: How do I show ALL field rows, including empty rows?? [email protected] Excel Worksheet Functions 2 April 8th 05 06:21 PM


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

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

About Us

"It's about Microsoft Excel"