Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Counting the number of consecutive cells/rows that have the same entry

Hi,
I have tried using the count functions in excell to count the number
of cells that are in consecutive order that have the same value, but I
can not get my head around it. I have rows of data with fixed entries
say A B C D and E and i want to put into the column next to the
entries a formula /vba programme that counts the the numbers above and
below if they = the number in the cell and only until there is a
change in numbers e.g

Column A Column B
A 2
A 2
B 1
C 2
C 2
B 1
D 2
D
C
C
C
D
E
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Counting the number of consecutive cells/rows that have the same entry

Hi Chantelle,

I have tried using the count functions in excell to count the number
of cells that are in consecutive order that have the same value, but I
can not get my head around it. I have rows of data with fixed entries
say A B C D and E and i want to put into the column next to the
entries a formula /vba programme that counts the the numbers above and
below if they = the number in the cell and only until there is a
change in numbers e.g


You can achieve this using worksheet functions, but it takes two columns:

A B C
1 Col1 Col2 Col3
2 A =IF(A2=A1,B1+1,1) =IF(A2=A3,C3,B2)
3 A ...copy down... ...copy down...
4 B

Column C then contains the numbers you want.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk


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
Counting the Number of Consecutive Ranges allan2005CL Excel Worksheet Functions 0 August 22nd 10 08:46 PM
counting the number of consecutive days 12-17-09 LEG Excel Worksheet Functions 2 December 18th 09 06:02 PM
Counting the largest number of consecutive 1's in a column DavidS New Users to Excel 3 November 17th 06 11:19 AM
Counting number of consecutive zeros at the end of a list [email protected] Excel Discussion (Misc queries) 2 September 22nd 05 12:47 PM
cells() and counting number or rows on spreadsheet HeatherO Excel Worksheet Functions 7 March 2nd 05 10:36 AM


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