+ Reply to Thread
Results 1 to 17 of 17

Count specific number in a table when given number appears in same row (modified)

  1. #1
    Forum Contributor
    Join Date
    06-24-2012
    Location
    Australia
    MS-Off Ver
    Office365
    Posts
    302

    Count specific number in a table when given number appears in same row (modified)

    Hi Experts,
    In a given table, when specific number occurs, find another given number that occurred along with specific number in row same time.

    choosing data and filters consume too much time !

    File attached (excel 2007 revised on 3May






    1 1 6 6 6 8 9
    2 2 5 7 7 8 9
    3 2 6 7 8 9 9
    4 1 3 5 6 8 9
    5 2 5 5 6 6 9
    6 1 1 1 6 7 8
    7 5 6 7 7 9 9
    8 4 4 5 5 6 8
    9 1 2 4 5 5 6
    10 6 7 7 7 8 9

    task:
    If only 6 present in a row from B1:G10 then count total number "8" in rows 1 to 10
    (following is result manually counted)
    Count number of 8 when 6 appears in same row from table
    Final Results:
    If following No is present =6 Count 8 total =6






    Thanks in advance
    Karnik
    Attached Files Attached Files
    Last edited by Karnik; 05-02-2015 at 07:19 PM. Reason: modified Excel attacement

  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: Count specific number in a table when given number appears in same row (modified)

    Maybe this

    =IF(COUNTIF(B1:G10,6)>0,COUNTIF(B1:G10,8),"")
    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 Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Count specific number in a table when given number appears in same row (modified)

    Alkey, I've been looking at this off and on for a while now. My own meanderings are taking me into very overcomplicated areas!! I don't think that yours is there yet, as it counts the 8 in F2, which is in a row without a 6.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Contributor
    Join Date
    06-24-2012
    Location
    Australia
    MS-Off Ver
    Office365
    Posts
    302

    Re: Count specific number in a table when given number appears in same row (modified)

    Hi Alkey,
    May be I have confused and not clear
    Your suggestion counts all number 8 in the given table.
    I am seeking, eg. if 6 is present THEN count 8 number from the row. If 6 is not present and 8 is in the row then 8 is not counted or dropped from that row
    Thanks
    Karnik

  5. #5
    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: Count specific number in a table when given number appears in same row (modified)

    Ok

    in H1 and copy down

    =IF(COUNTIF(B1:G1,6)>0,COUNTIF(B$1:G$10,8),"")

  6. #6
    Forum Contributor
    Join Date
    06-24-2012
    Location
    Australia
    MS-Off Ver
    Office365
    Posts
    302

    Re: Count specific number in a table when given number appears in same row (modified)

    Hi Glenn
    Thanks for your visit
    Regards
    Karnik

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Count specific number in a table when given number appears in same row (modified)

    Karnik, in your example, shoouldn't the answer be 6, not 7....

  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: Count specific number in a table when given number appears in same row (modified)

    i guess I should've been this

    In H1 and copy down

    =IF(COUNTIF(B1:G1,6)>0,COUNTIF(B1:G1,8),0)

    and yes, the answer should be 6

  9. #9
    Forum Contributor
    Join Date
    06-24-2012
    Location
    Australia
    MS-Off Ver
    Office365
    Posts
    302

    Re: Count specific number in a table when given number appears in same row (modified)

    Hi Alkey and Glenn,
    Yes it should be 6,
    Alkey your solution works if copied to last row and again counting total
    Ideally I had planned to replace by cell number to change to required digit.
    Regards
    Karnik

  10. #10
    Forum Contributor
    Join Date
    06-24-2012
    Location
    Australia
    MS-Off Ver
    Office365
    Posts
    302

    Re: Count specific number in a table when given number appears in same row (modified)

    Hi Experts,
    file also edited and shown in main file
    Please expert
    Karnik

  11. #11
    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: Count specific number in a table when given number appears in same row (modified)

    The number is replaced with cell reference J$2

    in H1 and copy down

    =IF(COUNTIF(B1:G1,J$2)>0,COUNTIF(B1:G1,8),0)

    in M2 enter sum formula

    =SUM(H1:H10)

  12. #12
    Forum Contributor
    Join Date
    06-24-2012
    Location
    Australia
    MS-Off Ver
    Office365
    Posts
    302

    Re: Count specific number in a table when given number appears in same row (modified)

    Hi Alkey,
    Thanks for looking in to it, your suggestion works , as data runs in 5266 rows it becomes too cumbersome copy in all rows.
    Any way we can put your function in Array to make it fast/simple? or VB (I am too nervous!)

    Regards
    Karnik

  13. #13
    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: Count specific number in a table when given number appears in same row (modified)

    You only have to copy it once and all you have to do is to change the number in J2. Since you have to examine each row, I don't really see any other option. Maybe someone else will take a look and offer a better solution.

  14. #14
    Forum Contributor
    Join Date
    06-24-2012
    Location
    Australia
    MS-Off Ver
    Office365
    Posts
    302

    Re: Count specific number in a table when given number appears in same row (AmendmenT)

    Hello Expert,

    Forum Expert Alkey has brilliantly suggested function to out fish two numbers when appear in a row.
    Now I have been given task to fish out three numbers when (all three) appear in a row.
    correct function for 2 numbers by forum Expert Alkey is:

    =IF(COUNTIF($B10:$G10,$H$2)>0,COUNTIF($B10:$G10,$I$2),0)

    My modified function that is incorrect is:

    =IF(and(COUNTIF($B10:$G10,$H$2)>0,AND(COUNTIF($B10:$G10,$I$2)>0,AND(COUNTIF($B10:$G10,$J$2)),0))

    I have been struggling to modify correctly , but no luck, I have attached file again for kind perusal,

    Thanks in advance

    Karnik
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    06-24-2012
    Location
    Australia
    MS-Off Ver
    Office365
    Posts
    302

    Re: Please correct my incorrect function formula!

    Hi Experts,
    My function formula is in correct as follows,
    Please connect it!
    For details look in to attachment or trails of below

    =IF(and(COUNTIF($B10:$G10,$H$2)>0,AND(COUNTIF($B10:$G10,$I$2)>0,AND(COUNTIF($B10:$G10,$J$2)),0))

    Thanks
    Karnik

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Count specific number in a table when given number appears in same row (modified)

    Is this what you had in mind?
    Attached Files Attached Files

  17. #17
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Please correct my incorrect function formula!

    Something odd here. I have replied, but I can't access the reply. So, I'll try again.

    Is this what you had in mind?
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 05-10-2015 at 04:31 AM.

+ 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 the number of times a number appears in a specific range
    By myjebay1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2013, 11:01 AM
  2. Count number a times a specific value appears consecutively.
    By kww0027 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-03-2013, 06:17 PM
  3. Count the number of times a specific text appears in column D
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-04-2011, 02:02 PM
  4. Replies: 5
    Last Post: 11-22-2010, 06:31 PM
  5. [SOLVED] count the number of times a specific word appears in a column
    By BAR in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2006, 12:10 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