+ Reply to Thread
Results 1 to 17 of 17

IF Count Formula - Won't Count Duplicates

  1. #1
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    IF Count Formula - Won't Count Duplicates

    My formula skills are pretty rudimentary so for give my extra-lengthy formula below. I'm sure there is a way to make it cleaner. If so, feel free to let me know. However, that's not my issue here.

    Basically, this formula will add a couple columns based off of a name in another tab. If the name matches, a little addition is done and the answer is populated into the cell. My issues is that if the name is duplicated on the 'e-plan' tab, this formula will not work. I don't get an error, I simply get a blank cell.

    Any ideas on how to make sure that it calculates duplicate names also?

    The file itself is fairly large so I'm hoping the formula alone will give someone enough to work off of.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: IF Count Formula - Won't Count Duplicates

    Hi,

    It's difficult to comment without seeing the workbook.
    Please upload it and manually add the results you expect to see and explain which cells are results and how you have calculated them.

    We don't need a workbook with zillions of records or sheets so take a copy and cut it down in size leaving just a representative selection of data. Anonymise as necessary.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    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,589

    Re: IF Count Formula - Won't Count Duplicates

    Attach a sample workbook: 20 or so rows will do


    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: IF Count Formula - Won't Count Duplicates

    Can you post a SMALL sample file and show us what result you expect?

    A SMALL file will have about 20 rows worth of data.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    Re: IF Count Formula - Won't Count Duplicates

    Ok... so I've uploaded a "spreadsheet" with screen shots. As I stated, this workbook is large. If I try deleting some of it, I get errors everywhere so it's not possible for me to dwindle this thing down to just a small section. It pulls data from an outside source from our home office.

    Anyhoo... I think you will be able to see what I'm taking about.
    Attached Files Attached Files

  6. #6
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    Re: IF Count Formula - Won't Count Duplicates

    Any ideas on this one?

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: IF Count Formula - Won't Count Duplicates

    Sorry, but I have download size limits and your file is too big.

  8. #8
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    Re: IF Count Formula - Won't Count Duplicates

    Let's try this...

    Sheet 1 column A has a list of 10 names. Sheet 1 Columns B & C have numbers.

    Sheet 2 also has a list of names in column A. Column B will add columns B & C from sheet A if the names match.

    The current formula works unless a name is duplicated on Sheet 1. If the name is duplicated, the numbers do not populate on Sheet 2.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,969

    Re: IF Count Formula - Won't Count Duplicates

    We cannot really work with pics, can you try to mock up a smaller version of what you have? that way, we can offer specific suggestions, instead if just guessing at what you want.

    If you vlookup is not returning duplicates, then perhaps your ranges or criteria are wring?

    Or, are you sure it is an exact duplicate? check for leading/training spaces and typos
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  10. #10
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332
    I thought pictures might be a stretch. I'll whittle the spreadsheet down today and if there's errors showing everywhere, I'll delete those formulas out. This workbook has so much stuff in it that it'll take a while to delete all of it. It probably has 20 different tabs and about as many macros.

    The range is definitely correct because it works with a single name, regardless of which row and there's no way to mess up the spelling, etc. That is selected from a drop down menu.

    I'll post a small version today.

    Thanks!

    Quote Originally Posted by FDibbins View Post
    We cannot really work with pics, can you try to mock up a smaller version of what you have? that way, we can offer specific suggestions, instead if just guessing at what you want.

    If you vlookup is not returning duplicates, then perhaps your ranges or criteria are wring?

    Or, are you sure it is an exact duplicate? check for leading/training spaces and typos

  11. #11
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    Re: IF Count Formula - Won't Count Duplicates

    ok... I've deleted everything out and attached it here. Pay no mind to the errors. I put 3 names in the list. Two of them calculate correctly and one of them doesn't. The one that doesn't is because it is duplicated on the reference tab.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    06-30-2015
    Location
    Netherlands
    MS-Off Ver
    2013 / 2016 / 365
    Posts
    146

    Re: IF Count Formula - Won't Count Duplicates

    Hi,

    Change your formula in D9 to this and see if this is the correct result: [FORMULA]=SUMPRODUCT(('e-plan'!H1:H40='City Board with Calculator'!B9)*('e-plan'!I1:J40))[/FORMULA
    Attached Files Attached Files
    Last edited by joris moerings; 01-19-2017 at 07:42 AM.
    HtH,

    Joris

    --------------------------------------------------------------------------------
    If you found my answer helpful, please hit the Like or Thank button.

    Please follow the forum Rules and Guidelines and use Code tags around your VBA code.

    Remember: test VBA code always on a copy of your file because usually you can't use undo

  13. #13
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332
    Sorry but that one didn't work at all... it produces blank cells.

    Quote Originally Posted by joris moerings View Post
    Hi,

    Change your formula in D9 to this and see if this is the correct result: [FORMULA]=SUMPRODUCT(('e-plan'!H1:H40='City Board with Calculator'!B9)*('e-plan'!I1:J40))[/FORMULA

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,969

    Re: IF Count Formula - Won't Count Duplicates

    What are you trying to do with the formula in C9?
    =IFERROR(IF(COUNTIF('e-plan'!$H$2:$H$33,B9)>=2,INDEX('e-plan'!$G$2:$G$33,MATCH(B9,'e-plan'!$H$2:$H$33,0))+INDEX(OFFSET('e-plan'!$G$1,MATCH(B9,'e-plan'!$H$1:$H$33,0),0):'e-plan'!$G$33,MATCH(B9,OFFSET('e-plan'!$H$1,MATCH(B9,'e-plan'!$H$1:$H$33,0),0):'e-plan'!$H$33,0)),IF(COUNTIF('e-plan'!$H$2:$H$33,B9)=1,(INDEX('e-plan'!$G$2:$G$33,MATCH(B9,'e-plan'!$H$2:$H$33,0))),"")),0)

    Almost looks like this would do the same thing?
    =SUMIF('e-plan'!$H:$H,$B9,'e-plan'!$G:$G)
    (for the main part of that formula)

    Then for the next 1, either this...
    =SUMPRODUCT(--('e-plan'!$H$1:$H$33=$B9)*'e-plan'!$I$1:$J$33)

  15. #15
    Forum Contributor
    Join Date
    06-30-2015
    Location
    Netherlands
    MS-Off Ver
    2013 / 2016 / 365
    Posts
    146

    Re: IF Count Formula - Won't Count Duplicates

    In addition to FDibbins response: could you explain what's not working at all. The formula created the same result as your lengthy formula. If you took my attached workbook and just copied the formula down, you would need to check the relative reference and make it absolute as FDibbins did in his response.
    But even then it would create all 0 value because of the deleted data in E-plan tab of the file.

  16. #16
    Forum Contributor
    Join Date
    06-30-2015
    Location
    Netherlands
    MS-Off Ver
    2013 / 2016 / 365
    Posts
    146

    Re: IF Count Formula - Won't Count Duplicates

    In addition to FDibbins response: could you explain what's not working at all. The formula created the same result as your lengthy formula. If you took my attached workbook and just copied the formula down, you would need to check the relative reference and make it absolute as FDibbins did in his response.
    But even then it would create all 0 value because of the deleted data in E-plan tab of the file.

  17. #17
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    Re: IF Count Formula - Won't Count Duplicates

    Joris - My apologies... you are correct. I did my original testing of your formula using my mobile device. My apologies. However, I have since applied it and it does work for except for the rows that contain no data in column B toward the bottom (rows 31 & 32). For some reason, your formula produces an "8" for those particular cells. I'm sure it has something to with the blank cell in column B.

    Quote Originally Posted by joris moerings View Post
    In addition to FDibbins response: could you explain what's not working at all. The formula created the same result as your lengthy formula. If you took my attached workbook and just copied the formula down, you would need to check the relative reference and make it absolute as FDibbins did in his response.
    But even then it would create all 0 value because of the deleted data in E-plan tab of the file.
    FDibbins - Your 2nd formula worked for me and solved my original request. I tried using your first formula and the same as above happened. When it got to the bottom couple rows that were blank, it produced weird results in some of the other cells to the right. So, I just left my big ol' long caveman-style formula,... haha

    What are you trying to do with the formula in C9?
    =IFERROR(IF(COUNTIF('e-plan'!$H$2:$H$33,B9)>=2,INDEX('e-plan'!$G$2:$G$33,MATCH(B9,'e-plan'!$H$2:$H$33,0))+INDEX(OFFSET('e-plan'!$G$1,MATCH(B9,'e-plan'!$H$1:$H$33,0),0):'e-plan'!$G$33,MATCH(B9,OFFSET('e-plan'!$H$1,MATCH(B9,'e-plan'!$H$1:$H$33,0),0):'e-plan'!$H$33,0)),IF(COUNTIF('e-plan'!$H$2:$H$33,B9)=1,(INDEX('e-plan'!$G$2:$G$33,MATCH(B9,'e-plan'!$H$2:$H$33,0))),"")),0)

    Almost looks like this would do the same thing?
    =SUMIF('e-plan'!$H:$H,$B9,'e-plan'!$G:$G)
    (for the main part of that formula)

    Then for the next 1, either this...
    =SUMPRODUCT(--('e-plan'!$H$1:$H$33=$B9)*'e-plan'!$I$1:$J$33)
    Sorry for the delay in replying to you guys... I appreciate the 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. Count formula without counting duplicates
    By jason4444 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-14-2016, 10:07 PM
  2. Non-array formula to count non-duplicates
    By Dendrobates in forum Excel General
    Replies: 3
    Last Post: 04-06-2015, 06:30 PM
  3. Replies: 3
    Last Post: 10-23-2014, 04:50 PM
  4. [SOLVED] Formula to count duplicates in 1, 2, 3 order
    By kas05j in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-25-2014, 11:02 AM
  5. Removing duplicates in a count, count based on value in a different cell
    By omf_24 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-10-2013, 07:08 AM
  6. Using a Formula to Count Duplicates in two Columns
    By JungleJme in forum Excel General
    Replies: 2
    Last Post: 08-25-2010, 07:01 AM
  7. count a group of numbers but do not count duplicates
    By Lisaml in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-26-2005, 08:06 PM

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