+ Reply to Thread
Results 1 to 5 of 5

Removing duplicates and counting the number of occurrences of strings

  1. #1
    Registered User
    Join Date
    08-23-2022
    Location
    London
    MS-Off Ver
    Microsoft 365 MSO (Version 2207 Build 16.0.15427.20182) 64-bit
    Posts
    2

    Question Removing duplicates and counting the number of occurrences of strings

    Hello everyone, I'm new here and a novice to excel/powerquery but I can write code so I'm hoping my understanding will be good enough to find the solution to this problem.

    I'm hoping someone could very kindly help me with this query as it's for a University Project and it would be really exciting if someone can help me make this work.

    Here's a snippet of the sheet I'm working with:
    Original sheet.png

    As you can see in this Sheet I have two columns; one 'Country' column, which states a single country of origin for a person who answered a questionnaire. The second column states the number of programming languages they currently use, delimited with a ';'. All languages were selected from a checkbox and so, for example 'JavaScript' is always written exactly as 'JavaScript'.


    What I'd like to achieve is to have each country in my countries list only appear once, and the number of participants who stated this was a language they have worked with as a number value in each 'language' column.

    Here's a model of what I like to achieve (I just made up the data to illustrate what I'm looking for)
    goal.png


    I've already tried to use Formulas and also PowerQuery to acheive this but I can't figure out how to do it without a hugely manual process of creating conditional columns for every single country.. and it's a big dataset.

    I've attached an extract of the original dataset (as the full version was too large of a filesize) that I'm working with to this post, in case that's useful.

    If anyone can help me out I'd appreciate it so much - thank you in advance for taking the time to read!

  2. #2
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Removing duplicates and counting the number of occurrences of strings

    daniel the newbie: Welcome to the forum.

    You'll need 2 unique lists.
    One with the countries in column D
    Across the top, in row 1 place your languages, 1 in each cell starting in Col. E. Cell: E1
    Place your existing 2 column table in columns A and B
    Column C is blank.

    MODIFIED Place this into E2:
    Please Login or Register  to view this content.
    Copy across and down.



    If you add a country that's not in the original list, just manually add it to col. D, and copy down your column formulas. You can resort if that's desirable.

    Pete
    Last edited by PeteABC123; 08-23-2022 at 03:57 PM.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,872

    Re: Removing duplicates and counting the number of occurrences of strings

    Using Power Query, I unpivoted the data in the Applications Column and then closed and loaded the data back to Excel. I then created a Pivot Table with the Country as Rows and the Apps as headers and a count. Review in the attached.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Removing duplicates and counting the number of occurrences of strings

    Please Login or Register  to view this content.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Registered User
    Join Date
    08-23-2022
    Location
    London
    MS-Off Ver
    Microsoft 365 MSO (Version 2207 Build 16.0.15427.20182) 64-bit
    Posts
    2

    Re: Removing duplicates and counting the number of occurrences of strings

    Wow, I have a lot to learn. Thank you all for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Removing duplicates and counting
    By synergy80 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 07-28-2022, 08:57 PM
  2. Counting text occurrences (minus duplicates) in different ranges
    By RnTheAndrian in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2019, 04:47 PM
  3. Removing duplicates from a column with text strings
    By saahilnagrani in forum Excel General
    Replies: 1
    Last Post: 02-05-2015, 05:04 AM
  4. [SOLVED] Counting Delimited Unique Strings and Removing Duplicates
    By The831st in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-30-2014, 11:51 AM
  5. [SOLVED] Formula for counting the number of occurrences within a range of cells AND Strings help
    By V1gilante in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-14-2014, 07:58 PM
  6. Replies: 13
    Last Post: 03-14-2011, 03:50 PM
  7. Counting number of occurrences
    By LyleB_Austin in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-15-2005, 06:05 PM

Tags for this Thread

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