+ Reply to Thread
Results 1 to 8 of 8

Count number in row if another number exist

  1. #1
    Forum Contributor
    Join Date
    08-26-2009
    Location
    Iceland
    MS-Off Ver
    Excel 365, Windows 10
    Posts
    110

    Count number in row if another number exist

    Hi,

    I want to count how many times specific number appear (f.x. no 12) in a column if number 1 is in the column.
    I want to count how many times specific number appear (f.x. no 10) in a column if number 2 is in the column.

    Problem is, I have many columns I cannot combine it.

    Example
    A B C
    1 1 9
    15 5 15
    33 17 23
    36 22 28
    38 36 29

    I want to find out in row A, B and C if 1 is in any column (here in column A), how many times number 2, 3, 4 etc appears.

    Result here is
    Number 1
    5 , 1x
    15, 1x
    17, 1x
    22, 1x
    33, 1x
    36, 2x
    38, 1x

    Number 15
    1, 1x
    9, 1x
    23,1x
    28,1x
    29,1x
    33,1x
    36,1x
    38,1x

    I want to put this in array
    Last edited by Reykjavik; 07-03-2013 at 09:21 PM. Reason: change row to column.

  2. #2
    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,936

    Re: Count number in row if another number exist

    Please confirm that when you say ROW, you mean COLUMN?

    I want to find out in row A, B and C
    These are columns, not rows?
    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

  3. #3
    Forum Contributor
    Join Date
    08-26-2009
    Location
    Iceland
    MS-Off Ver
    Excel 365, Windows 10
    Posts
    110

    Re: Count number in row if another number exist

    sorry,

    Yes thats right, column is it.

  4. #4
    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,936

    Re: Count number in row if another number exist

    Take a look at the attached. Im not sure which way you want to do this...the 1st tableA9:D49 is based on the values of each column, the 2nd table is based on the values from all columns
    Attached Files Attached Files

  5. #5
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Count number in row if another number exist

    =IF(ISNUMBER(COUNT($B$8,A$2:A$6)),COUNTIF(A$2:A$6,$A10),0)

    @FDibbins. It's not necessary to include IF(ISNUMBER(COUNT($B$8,A$2:A$6)),

    Just use the last part of your formula
    =COUNTIF(A$2:A$6,$A10)

  6. #6
    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,936

    Re: Count number in row if another number exist

    @ toothless...true

  7. #7
    Forum Contributor
    Join Date
    08-26-2009
    Location
    Iceland
    MS-Off Ver
    Excel 365, Windows 10
    Posts
    110

    Re: Count number in row if another number exist

    FDibbins I was looking for solution in 2nd table.

    Thanks to all of you,

  8. #8
    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,936

    Re: Count number in row if another number exist

    Happy to help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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