+ Reply to Thread
Results 1 to 12 of 12

Countif Formula that can be dragged down

  1. #1
    Forum Contributor
    Join Date
    06-25-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016
    Posts
    615

    Countif Formula that can be dragged down

    Hi folks

    Have attached a sample sheet for perusal.

    Cheers
    hammer
    Attached Files Attached Files

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Countif Formula that can be dragged down

    In B2 and copy down

    =COUNTIF($A$2:$A$7,A2)


    However, if you want to count only unique numbers you can use formula below

    =IF(COUNTIF($A$2:$A2,A2)=1,1,0)
    Last edited by AlKey; 10-11-2014 at 11:52 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Contributor
    Join Date
    06-25-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016
    Posts
    615

    Re: Countif Formula that can be dragged down

    Hi AlKey

    That formula does not work for me.
    B8 should be returning "3" for me.
    So the value 6 in A in sheet1 shows up 4 times but only 3 times with 1 adjacent in B.
    Thanks

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Countif Formula that can be dragged down

    Your example does not have any values in column B. How do one supposed to know where are the ones should be?

  5. #5
    Forum Contributor
    Join Date
    06-25-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016
    Posts
    615

    Re: Countif Formula that can be dragged down

    Hi AlKey
    Apologies if my sample is incorrect.
    Sheet2 ColB is where I need to place the formula.

    So sheet2 B8 should return 3 being the count of "6" from sheet1 Col A with adjacent "1" in Col B from sheet1

    Hope this makes it clearer
    Thanks

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Countif Formula that can be dragged down

    Oh, I didn't see sheet one. My bad.

    =COUNT(IF(Sheet1!$B$2:$B$15=1,Sheet1!$A$2:$A$15))



    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

  7. #7
    Forum Contributor
    Join Date
    06-25-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016
    Posts
    615

    Re: Countif Formula that can be dragged down

    Hi
    That one is returning 3 in every cell in Col B
    Hopefully to explain myself better sheet2 A2 has "0" in it.

    I want to look up "0" in Col A Sheet1 to find the "0"s that have "1" in the adjacent cell Col B sheet1
    and to return the count of same in B2 Sheet2 etc and to be able to pull it down.

    Thanks

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Countif Formula that can be dragged down

    Sorry, I don't think I understand what you want. It happens to me once in while so maybe this is one of those nights.

  9. #9
    Forum Contributor
    Join Date
    06-25-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016
    Posts
    615

    Re: Countif Formula that can be dragged down

    I think I may have fluked it

    =COUNTIFS(Sheet1!A:A,Sheet2!A2,Sheet1!B:B,1)

    That works when dragged down as it changes Sheet2!A2 to Sheet2!A3 etc

    Thanks for your time Al-appreciated

  10. #10
    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
    53,050

    Re: Countif Formula that can be dragged down

    I know exactly what AlKey means about sometimes not understanding Try this...
    =COUNTIFS(Sheet1!$A$2:$A$15,Sheet2!A2,Sheet1!$B$2:$B$15,1)
    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

  11. #11
    Forum Contributor
    Join Date
    06-25-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016
    Posts
    615

    Re: Countif Formula that can be dragged down

    Snap! Thanks to you too Sir!

  12. #12
    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
    53,050

    Re: Countif Formula that can be dragged down

    Glad it worked for you

+ 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. Formula does not recalculate when dragged into next row
    By vulture165 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-24-2013, 12:09 PM
  2. Windows Vista : How do I show a dragged formula as zero?
    By fithawk in forum Microsoft Windows Help
    Replies: 2
    Last Post: 05-02-2012, 02:07 PM
  3. Excel 2007 : How do I show a dragged formula as zero?
    By fithawk in forum Excel General
    Replies: 1
    Last Post: 05-02-2012, 04:26 AM
  4. Sample variance formula that can be dragged down
    By rmb623 in forum Excel General
    Replies: 8
    Last Post: 05-30-2011, 02:59 AM
  5. Formula not changing when Dragged!!!!
    By aposatsk in forum Excel General
    Replies: 2
    Last Post: 08-17-2006, 09:55 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