single list of unique values from multiple columns

gabbrielle

New Member
Joined
Jun 6, 2018
Messages
2
Hey good people,

So here's my thing. I have multiple columns with keywords I want to analyse. Basically, what I need is a table with the number of time each word is use. My strategy was to use a advance filter and find the unique values, then do a =countif with the three columns as my range. The advance filter does not work with multiple columns (at least I can't get it to work).

So any suggestions either to get the advance filter to work or to get that table with
A) a list of all unique values
B) the count of those unique values for the whole range of the three columns.

Thanks tons

Gabrielle
Montréal


engagementsengagementsengagements
manifestationsconversationbénévolat
manifestationsQuotidienbénévolat
bénévolat
quotidienbanane
bénévolat
ne m'implique plus
travail pour un groupeconversation
manifestationsprise de parole
étudeséduquerévénements
manifestationsévénementsécrits
manifestations bénévolat
conversation
Unicorn bénévolat
Simone
quotidienconversationéduquer
écrits
membre d'un groupe écrits
manifestationsrechercheévénements
bénévolatétuquerconversations
bénévolat
quotidienmanifestationconversations
conversation
manifestationécrits
conversation
bénévolatmembre d'un groupeécrits
écritsconversationbénévolat
membre d'un groupeévénements
membre d'un groupelecture
conversationmembre d'un groupeévénements
travail pour un groupeconversationbénévolat
conversationévénementprise de parole
manifestationsécritsconversations
manifestationsbénévolatconversations
travail pour un groupemanifestationconversations
bénévolatlecture

<colgroup><col span="3"></colgroup><tbody>
</tbody>
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi & welcome to MrExcel.
How about
Code:
Sub CountUnique()
   Dim Ary As Variant
   Dim r As Long, c As Long
   
   Ary = ActiveSheet.UsedRange.Offset(1)
   With CreateObject("scripting.dictionary")
      For r = 1 To UBound(Ary)
         For c = 1 To UBound(Ary, 2)
            If Not .exists(Ary(r, c)) And Not IsEmpty(Ary(r, c)) Then
               .Add Ary(r, c), 1
            ElseIf Not IsEmpty(Ary(r, c)) Then
               .Item(Ary(r, c)) = .Item(Ary(r, c)) + 1
            End If
         Next c
      Next r
      Range("E1").Resize(.Count).Value = Application.Transpose(.keys)
      Range("F1").Resize(.Count).Value = Application.Transpose(.items)
   End With
End Sub
 
Upvote 0
The following macro is basically the same as the one Fluff posted, but I handle the assignment of elements to the Dictionary differently than Fluff does which has the effect of making my code more compact than his...
Code:
[table="width: 500"]
[tr]
	[td]Sub CountUnique()
  Dim V As Variant, Arr As Variant
  Arr = ActiveSheet.UsedRange.Offset(1)
  With CreateObject("Scripting.Dictionary")
    For Each V In Arr
      If Len(V) Then .Item(V) = .Item(V) + 1
    Next
    Range("E1").Resize(.Count).Value = Application.Transpose(.Keys)
    Range("F1").Resize(.Count).Value = Application.Transpose(.Items)
  End With
End Sub[/td]
[/tr]
[/table]
 
Upvote 0
....

Clearly, I'm way over my head. I don't even know what to do with the formula. :-/

Thanks you two for answering so quickly. I really appreciate it.
 
Upvote 0
....

Clearly, I'm way over my head. I don't even know what to do with the formula. :-/

Thanks you two for answering so quickly. I really appreciate it.
They are not formulas, they are macros. See if the following helps you...

HOW TO INSTALL MACROs
------------------------------------
If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (CountUnique) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "Yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0
If you want a formula version, then try:

ABCDE
1engagementsengagementsengagementsWordsCount
2manifestationsconversationbénévolatmanifestations8
3manifestationsQuotidienbénévolatconversation10
4bénévolatbénévolat13
5quotidienbananeQuotidien4
6bénévolatbanane1
7ne m'implique plusne m'implique plus1
8travail pour un groupeconversationtravail pour un groupe3
9manifestationsprise de paroleprise de parole2
10étudeséduquerévénementsétudes1
11manifestationsévénementsécritséduquer2
12événements5
13manifestationsbénévolatécrits7
14conversationUnicorn1
15UnicornbénévolatSimone1
16Simonemembre d'un groupe5
17quotidienconversationéduquerrecherche1
18écritsétuquer1
19membre d'un groupeécritsconversations5
20manifestationsrechercheévénementsmanifestation3
21bénévolatétuquerconversationslecture2
22bénévolatévénement1
23quotidienmanifestationconversations
24conversation
25manifestationécrits
26conversation
27bénévolatmembre d'un groupeécrits
28écritsconversationbénévolat
29membre d'un groupeévénements
30membre d'un groupelecture
31conversationmembre d'un groupeévénements
32travail pour un groupeconversationbénévolat
33
34conversationévénementprise de parole
35manifestationsécritsconversations
36manifestationsbénévolatconversations
37travail pour un groupemanifestationconversations
38bénévolatlecture

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
E2=IF(D2<>"",COUNTIF($A$2:$C$50,D2),"")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
D2{=IFERROR(INDIRECT(TEXT(MIN(IF($A$2:$C$50<>"",IF(COUNTIF($D$1:$D1,$A$2:$C$50)=0,ROW($A$2:$C$50)*100+COLUMN($A$2:$C$50)))),"R00C00"),0),"")}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

However, you still might want to try the macros. It's much easier to update a macro with additional requirements, for example, if you want the list sorted.
 
Upvote 0

Forum statistics

Threads
1,216,750
Messages
6,132,505
Members
449,730
Latest member
SeanHT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top