+ Reply to Thread
Results 1 to 3 of 3

Contents of a column/table

Hybrid View

  1. #1
    Registered User
    Join Date
    01-06-2009
    Location
    London, England
    MS-Off Ver
    Excel 2002
    Posts
    1

    Contents of a column/table

    Hi All,

    I want to do something seemingly easy:

    Suppose I have this data

    Column

    RowAa
    RowAa
    RowAa
    RowAa
    RowAa
    RowAb
    RowAb

    And I want to get to this:

    RowAa 5 (as it occurred 5 times)
    RowAb 2 (idem, 2 times)

    I could do countif(A1:A7, “=RowAa) (supposing the data is are located in A1:A7)

    However, I don’t want to assign all countif’s manually to the values I want to count.

    As a somewhat acceptable solution I tried:
    countif(A1:A7, “=A1”) which mysteriously comes up with 0.

    All I want to do is have an overview what’s in the table. That’s: what values and how often.

    Anybody have a way of doing this?

    Cheers,

    Dennis
    Last edited by Beest; 01-06-2009 at 12:25 PM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    Hi Dennis

    Use a Pivot Table to do this. If you haven't used them before here's a useful guide:

    http://peltiertech.com/Excel/Pivots/pivottables.htm

    Regarding your problem formula, that would need to be:

    =COUNTIF(A1:A7,"=" & A1)

    or more simply:

    =COUNTIF(A1:A7,A1)

    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, This will give you the desired result in column "B"
    Dim Data, Uni As Long, Multi As Long, c As Integer, P As Long, Tot()
    Data = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
    P = 0
    For Uni = 1 To UBound(Data)
    
    For Multi = Uni + 1 To UBound(Data)
        If Data(Uni, 1) <> "" And Data(Uni, 1) = Data(Multi, 1) Then
            c = c + 1
            Data(Multi, 1) = ""
        End If
    Next Multi
    
    If c > 0 Then
        ReDim Preserve Tot(P)
        Tot(P) = Data(Uni, 1) & "  " & c + 1
        P = P + 1
        c = 0
    End If
    
    Next Uni
    Range("B1").Resize(P).Value = Application.Transpose(Tot)
    Regards Mick

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1