+ Reply to Thread
Results 1 to 6 of 6

Help with (possible) SUM/COUNTIF formula

  1. #1
    Registered User
    Join Date
    09-21-2021
    Location
    Ireland
    MS-Off Ver
    2019
    Posts
    4

    Help with (possible) SUM/COUNTIF formula

    Hello all,

    This might be a simple thing but I cannot for the life of me figure this out, so any help would be massively appreciated.

    Hope I explain this right, I have 2 columns, column A is the locations that shifts are worked, and column B is the names of the employees working there. What I want is to get a total employee count for each location excluding duplicates. As employees are booked per shift, they appear multiple times in column B, but for counting purposes, I want them to exclude duplicates.

    Attached is a basic list, the actual one I am working from would have hundreds of lines for locations/employees. What I am trying to achieve here is in column D&E. I just can't figure out the formula.

    Thanks in advance
    Attached Files Attached Files

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

    Re: Help with (possible) SUM/COUNTIF formula

    A quick and easy solution using Power Query

    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    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

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,471

    Re: Help with (possible) SUM/COUNTIF formula

    Welcome to the forum.

    Try this:

    =SUM(IF($A$2:$A$27=D2, 1/(COUNTIFS($A$2:$A$27, D2, $B$2:$B$27, $B$2:$B$27)), 0))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    09-21-2021
    Location
    Ireland
    MS-Off Ver
    2019
    Posts
    4

    Re: Help with (possible) SUM/COUNTIF formula

    Hi Ali,

    Thanks for this, just getting round to trying it out now after a weeks holidays! When I try this formula, for CCS, its dividing by the number of times it appears so is returning 0.333333. The others it returns zero as there are more than 1 employee against it.

  5. #5
    Registered User
    Join Date
    09-21-2021
    Location
    Ireland
    MS-Off Ver
    2019
    Posts
    4

    Re: Help with (possible) SUM/COUNTIF formula

    Thanks Alan, Power Query is definitely something I need to look into! Appreciate the links.

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

    Re: Help with (possible) SUM/COUNTIF formula

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. [SOLVED] Help with countif formula for calendar (countif any date in table present)
    By KMJ256388 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-25-2021, 12:11 PM
  2. [SOLVED] formula to identify the unique code after filtration using countif or other formula
    By felixpanganiban in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-27-2019, 01:25 PM
  3. [SOLVED] COUNTIF formula where part of the range reference needs to use the result of a formula
    By zookeepertx in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 11-09-2018, 05:39 PM
  4. Adding a COUNTIF function to an existing IF AND COUNTIF Formula...
    By Ourkid123uk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2018, 10:09 AM
  5. Faster if/countif formula for flagging uniques - countif too slow
    By Speshul in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-19-2015, 01:44 PM
  6. [SOLVED] =Subtotal(countif,Range); Subtotal and countif in 1 formula [SOLVED]
    By thomas.mapua in forum Excel General
    Replies: 5
    Last Post: 01-06-2012, 11:33 AM
  7. Adding a CountIF to a formula that is already Countif
    By Cmorgan in forum Excel General
    Replies: 4
    Last Post: 06-01-2011, 09:34 AM

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