Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default count last number appear

How do I count the number of calls it takes a number to repeat? For example: 1 2 3 4 5 6 7 8 1
so it takes 8 calls for number 1 to repeat.

thanks

EggHeadCafe - Software Developer Portal of Choice
Design Pattern Interview Questions Part 3
http://www.eggheadcafe.com/tutorials...interview.aspx
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,203
Default count last number appear

Assuming that your list of numbers to test for repeats is in column A, and
that you enter the number to check for in cell C1 (your 1 in this case), then
this is the basis for the formula to do the counting:
=MATCH(C1,INDIRECT("A" & MATCH(C1,A:A,0)+1 & ":A65536"),0)-MATCH(C1,A:A,0)+1

But there are a couple of potential errors that would return a #NA! error:
the number you enter in C1 is not in the list at all, or it is not repeated.
This formula will catch those and give you a clear indication of "what's
wrong":
=IF(ISNA(MATCH(C1,A:A,0)),"Not In List",IF(ISNA(MATCH(C1,INDIRECT("A" &
MATCH(C1,A:A,0)+1 & ":A65536"),0)-MATCH(C1,A:A,0)+1),"Not
Repeated",MATCH(C1,INDIRECT("A" & MATCH(C1,A:A,0)+1 &
":A65536"),0)-MATCH(C1,A:A,0)+1))

I used 65536 as the last row number to check when looking for the repeated
number, but any number large enough to encompass the entire list would do as
long as it is not greater than the maximum number of rows in your version of
Excel.

"sierra spiegel" wrote:

How do I count the number of calls it takes a number to repeat? For example: 1 2 3 4 5 6 7 8 1
so it takes 8 calls for number 1 to repeat.

thanks

EggHeadCafe - Software Developer Portal of Choice
Design Pattern Interview Questions Part 3
http://www.eggheadcafe.com/tutorials...interview.aspx
.

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
Count rows and insert number to count them. Mex Excel Discussion (Misc queries) 6 August 23rd 06 02:29 AM
count each cell that have a number and take that number and count. Vick Excel Discussion (Misc queries) 3 May 19th 06 01:51 AM
count a number that is less than a number and greater than a numbe Dale Excel Worksheet Functions 3 November 19th 05 05:14 PM
Number count - postcodes and need to count the numbers of tim... Mark - Aust Excel Discussion (Misc queries) 1 October 24th 05 10:00 AM
Count number of times a specific number is displayed in a cell ran subs Excel Worksheet Functions 1 June 27th 05 05:01 PM


All times are GMT +1. The time now is 08:24 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"