Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 23
Default Count subset-totals in column

I have a column with data.
The data consists of incremental numbers:

Column A

1
2
3
4

1
2

1
2
3

What I want to do in column B is count the number of instances of each subset.
Result would look like this:

Column A Column B
4
1
2
3
4
2
1
2
3
1
2
3

The largest subset consists of 9 instances.

I tried reaching a solution using CountIf and nested If-statements, but
without any luck. Anybody have any bright ideas?

by the way 1:
I do have the add-on morefucntions, but didn't recognize a usefull fuction
in there either).

by the way 2: I could replace the numbers with a single character if that
would help simplify this issue.

Thanks in advance for your help.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Count subset-totals in column

One way with a macro

Sub countinstancesbetweenblanks()
mc = "f"
lr = Cells(Rows.Count, mc).End(xlUp).Row
counter = 1
Do Until r2 lr
r1 = Columns(mc).Find(What:="*", after:=Cells(counter, mc),
LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Row
r2 = Columns(mc).Find(What:="", after:=Cells(r1, mc), LookIn:=xlValues,
LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Row
MsgBox r2 - r1
Cells(r1, mc).Offset(, 1) = r2 - r1
counter = r2
Loop
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pluggie" wrote in message
...
I have a column with data.
The data consists of incremental numbers:

Column A

1
2
3
4

1
2

1
2
3

What I want to do in column B is count the number of instances of each
subset.
Result would look like this:

Column A Column B
4
1
2
3
4
2
1
2
3
1
2
3

The largest subset consists of 9 instances.

I tried reaching a solution using CountIf and nested If-statements, but
without any luck. Anybody have any bright ideas?

by the way 1:
I do have the add-on morefucntions, but didn't recognize a usefull fuction
in there either).

by the way 2: I could replace the numbers with a single character if that
would help simplify this issue.

Thanks in advance for your help.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default Count subset-totals in column

Pluggie wrote:
I have a column with data.
The data consists of incremental numbers:

Column A

1
2
3
4

1
2

1
2
3

What I want to do in column B is count the number of instances of each subset.
Result would look like this:

Column A Column B
4
1
2
3
4
2
1
2
3
1
2
3

The largest subset consists of 9 instances.

I tried reaching a solution using CountIf and nested If-statements, but
without any luck. Anybody have any bright ideas?

by the way 1:
I do have the add-on morefucntions, but didn't recognize a usefull fuction
in there either).

by the way 2: I could replace the numbers with a single character if that
would help simplify this issue.

Thanks in advance for your help.


If there are now blank rows between subsets and the data starts in row 2, put
this in B2 and copy down (replace the 1000's with the number of rows in your data):

=IF(A2=1,IF(ISNUMBER(MATCH(1,A3:$A$1000,0)),
MATCH(1,A3:$A$1000,0),COUNT(A2:$A$1000)),"")

If there are blank rows between subsets, subtract 1 from the MATCH() result:

=IF(A2=1,IF(ISNUMBER(MATCH(1,A3:$A$1000,0)),
MATCH(1,A3:$A$1000,0)-1,COUNT(A2:$A$1000)),"")
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default Count subset-totals in column

Glenn wrote:
Pluggie wrote:
I have a column with data.
The data consists of incremental numbers:

Column A

1
2
3
4

1
2

1
2
3

What I want to do in column B is count the number of instances of each
subset.
Result would look like this:

Column A Column B
4
1 2 3
4 2
1 2 3
1 2 3
The largest subset consists of 9 instances.

I tried reaching a solution using CountIf and nested If-statements,
but without any luck. Anybody have any bright ideas?
by the way 1:
I do have the add-on morefucntions, but didn't recognize a usefull
fuction in there either).

by the way 2: I could replace the numbers with a single character if
that would help simplify this issue.

Thanks in advance for your help.


If there are now blank rows between subsets and the data starts in row
2, put this in B2 and copy down (replace the 1000's with the number of
rows in your data):

=IF(A2=1,IF(ISNUMBER(MATCH(1,A3:$A$1000,0)),
MATCH(1,A3:$A$1000,0),COUNT(A2:$A$1000)),"")

If there are blank rows between subsets, subtract 1 from the MATCH()
result:

=IF(A2=1,IF(ISNUMBER(MATCH(1,A3:$A$1000,0)),
MATCH(1,A3:$A$1000,0)-1,COUNT(A2:$A$1000)),"")



That first sentence should read "If there are NO blank rows..."
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 265
Default Count subset-totals in column

Assuming that A2:A12 contains the data, try...

B1:

=MATCH(9.99999999999999E+307,A:A)

B2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=IF(A1="",IF(A2<"",COUNT(A2:INDEX(A2:INDEX(A:A,$B $1),LOOKUP(9.9999999999
9999E+307,CHOOSE({1,2},$B$1-ROW(B2)+1,MATCH(TRUE,A2:INDEX(A:A,$B$1)="",0)
-1)))),""),"")

Hope this helps!

In article ,
Pluggie wrote:

I have a column with data.
The data consists of incremental numbers:

Column A

1
2
3
4

1
2

1
2
3

What I want to do in column B is count the number of instances of each subset.
Result would look like this:

Column A Column B
4
1
2
3
4
2
1
2
3
1
2
3

The largest subset consists of 9 instances.

I tried reaching a solution using CountIf and nested If-statements, but
without any luck. Anybody have any bright ideas?

by the way 1:
I do have the add-on morefucntions, but didn't recognize a usefull fuction
in there either).

by the way 2: I could replace the numbers with a single character if that
would help simplify this issue.

Thanks in advance for your help.

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 Unique Values from a Subset of a List Ricardo Dinis Excel Discussion (Misc queries) 5 January 13th 15 11:57 PM
Excel 2000, count, sort a list & count totals? sunslight Excel Worksheet Functions 1 April 9th 07 05:46 PM
How to enter symbols for subset or element of a subset in Excel? rwcita Excel Worksheet Functions 1 January 23rd 06 09:27 PM
How to count uniques of a SUMPRODUCT subset? KeLee Excel Worksheet Functions 2 December 9th 05 01:25 PM
Comparing/matching totals in a column to totals in a row Nicole L. Excel Worksheet Functions 3 January 27th 05 10:42 PM


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