Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Finding records that have 12 consecutive values.

I'm trying to find all the people in my spreadsheet who have given
donations for 12 consecutive months in the last 60 months. I know how
to do a simple count of all donations in the last 60 months, but I'm
not sure how to write a formula that will identify those who gave
consecutively for any 12 month period in th last 60 months. Any
ideas?
This is how I have my spreadsheet formatted.

Name | Month1| Month2| Month3| Month4| | Month5| | Month6| |
Month7| | Month8| ...
Johan Doe| $10 | $5 | $0 | $100 | $100 |
$0 | $10 | $10 |

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Finding records that have 12 consecutive values.

The following will make green any name who has contributed 12
consecutive months. Change rows and sheet name to suit.

Sub Macro1()
Dim iCol As Integer
Dim iCt As Integer
Dim iRow As Integer

For iRow = 2 To 6
iCt = 0
For iCol = 2 To 61
If Sheets("Sheet1").Cells(iRow, iCol) 0 Then
iCt = iCt + 1
Else
iCt = 0
End If
If iCt = 12 Then
Sheets("Sheet1").Cells(iRow, 1).Interior.ColorIndex = 4
Exit For
End If
Next iCol
Next iRow
End Sub

Hth,
Merjet



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
Finding Unmatched Records PA New Users to Excel 2 April 21st 10 03:47 PM
Exclude #N/A values and Return Numeric values to consecutive cells in Single Row Sam via OfficeKB.com Excel Worksheet Functions 5 February 9th 08 03:07 AM
finding records wayne Excel Programming 9 January 22nd 07 04:08 AM
Code not finding records ojackiec Excel Programming 3 December 21st 05 04:49 PM
Finding 5 consecutive empty rows JPL Excel Programming 4 June 4th 04 11:39 AM


All times are GMT +1. The time now is 03:06 PM.

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"