PC Review


Reply
Thread Tools Rate Thread

count uniques in same column, post in blank cell, repeat until end ofspreadsheet

 
 
S Himmelrich
Guest
Posts: n/a
 
      15th Jan 2008
A macro that fills the next blank row in same column as represented
below.

Column A
A
A
A
N
N
N
N
[blank cell] result should be "2" -> keep going
A
A
J
L
F
F
F
[blank cell] result should be "4"-> keep going until you get to the
end of the spreadsheet.




 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      15th Jan 2008
Public Sub ProcessData()
Dim i As Long
Dim LastRow As Long
Dim StartRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
StartRow = 1
For i = 2 To LastRow + 1

If .Cells(i, "A").Value = "" Then

.Cells(i, "A").Formula = "=SUMPRODUCT((A" & StartRow & ":A"
& i - 1 & "<> """")/" & _
"COUNTIF(A" & StartRow & ":A" & i -
1 & ",A" & StartRow & ":A" & i - 1 & "&""""))"
StartRow = i + 1
End If
Next i

End With

End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"S Himmelrich" <(E-Mail Removed)> wrote in message
news:a855e916-3413-406c-8600-(E-Mail Removed)...
>A macro that fills the next blank row in same column as represented
> below.
>
> Column A
> A
> A
> A
> N
> N
> N
> N
> [blank cell] result should be "2" -> keep going
> A
> A
> J
> L
> F
> F
> F
> [blank cell] result should be "4"-> keep going until you get to the
> end of the spreadsheet.
>
>
>
>



 
Reply With Quote
 
ShaneDevenshire
Guest
Posts: n/a
 
      15th Jan 2008
Hi,

Here is another solution:

Sub Macro1()
Dim B as Long, S, E, A
B = [A65536].End(xlUp).Row
S = ActiveCell.Address
Do
Do Until ActiveCell = ""
ActiveCell.Offset(1, 0).Select
E = ActiveCell.Offset(-1, 0).Address
Loop
A = S & ":" & E
Selection = Evaluate("SUM(1/Countif(" & A & "," & A & "))")
S = ActiveCell.Offset(1, 0).Address
Loop Until Range(E).Row >= B
End Sub


--
Cheers,
Shane Devenshire


"S Himmelrich" wrote:

> A macro that fills the next blank row in same column as represented
> below.
>
> Column A
> A
> A
> A
> N
> N
> N
> N
> [blank cell] result should be "2" -> keep going
> A
> A
> J
> L
> F
> F
> F
> [blank cell] result should be "4"-> keep going until you get to the
> end of the spreadsheet.
>
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count Uniques in Col H, Result in Blank Cell, For Each Next Loop ryguy7272 Microsoft Excel Programming 4 11th Nov 2008 03:43 PM
Count Uniques in Column G Until Change in Column C, then Restart C ryguy7272 Microsoft Excel Programming 5 7th Nov 2008 11:11 AM
Count Uniques in Column, put result in next blank cell and continueuntil last row S Himmelrich Microsoft Excel Programming 5 15th Jan 2008 05:31 PM
Count blank cell in a column shantanu Microsoft Excel Programming 2 5th Apr 2007 04:28 AM
Count Uniques within a list based on value of cell... =?Utf-8?B?TWVhdExpZ2h0bmluZw==?= Microsoft Excel Misc 3 20th Mar 2006 05:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:37 PM.