Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: using countif without a range

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Posts
    197
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I am trying to use a countif statement but I want don't want to look at a whole range just certain cells. I have tried different things but I keep getting an error. Here is something like I am trying.

    I just want to look at cells T17, T20 and T30 but nothing in between.
    =IF(COUNTIF((T17,T20,T30),"X")>0,"X","no")

    If you have any suggestions let me know.
    Thanks-


  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    The 1st argument of COUNTIF must be a cell range. A cell range is defined as...

    "To refer to a range of cells, enter the reference for the cell in the upper-left corner of the range, a colon (, and then the reference to the cell in the lower-right corner of the range."

  3. #3
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try the following:

    =IF(SUMPRODUCT((T17>0)*(T20>0)*(T30>0))=1,"X","no")
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  4. #4
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    83,648
    Post Thanks / Like
    Mentioned
    33 Post(s)
    Tagged
    6 Thread(s)

    Default

    On 2002-04-08 09:15, hawley wrote:
    I am trying to use a countif statement but I want don't want to look at a whole range just certain cells. I have tried different things but I keep getting an error. Here is something like I am trying.

    I just want to look at cells T17, T20 and T30 but nothing in between.
    =IF(COUNTIF((T17,T20,T30),"X")>0,"X","no")

    If you have any suggestions let me know.
    Thanks-
    It seems just an "X" in one the target cells is sufficient, to return as result an "X", otherwise a "no".

    =IF(SUMPRODUCT((T17="X")+(T20="X")+(T30="X"))>0,"X","no")

    would do that job.

  5. #5
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-08 09:36, Aladin Akyurek wrote:
    On 2002-04-08 09:15, hawley wrote:
    I am trying to use a countif statement but I want don't want to look at a whole range just certain cells. I have tried different things but I keep getting an error. Here is something like I am trying.

    I just want to look at cells T17, T20 and T30 but nothing in between.
    =IF(COUNTIF((T17,T20,T30),"X")>0,"X","no")

    If you have any suggestions let me know.
    Thanks-
    It seems just an "X" in one the target cells is sufficient, to return as result an "X", otherwise a "no".

    =IF(SUMPRODUCT((T17="X")+(T20="X")+(T30="X"))>0,"X","no")

    would do that job.
    To me it looks like hawley wants to evalute a 4 element set consisting of {T17,T20,T30,"X"}.

  6. #6
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Oops, I missed the bit about X being in there.

    =IF(SUMPRODUCT((T17="X")*(T20="X")*(T30="X"))=1,"X","no")

    [ This Message was edited by: Al Chara on 2002-04-08 09:54 ]

  7. #7
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    83,648
    Post Thanks / Like
    Mentioned
    33 Post(s)
    Tagged
    6 Thread(s)

    Default

    On 2002-04-08 09:38, Mark W. wrote:
    On 2002-04-08 09:36, Aladin Akyurek wrote:
    On 2002-04-08 09:15, hawley wrote:
    I am trying to use a countif statement but I want don't want to look at a whole range just certain cells. I have tried different things but I keep getting an error. Here is something like I am trying.

    I just want to look at cells T17, T20 and T30 but nothing in between.
    =IF(COUNTIF((T17,T20,T30),"X")>0,"X","no")

    If you have any suggestions let me know.
    Thanks-
    It seems just an "X" in one the target cells is sufficient, to return as result an "X", otherwise a "no".

    =IF(SUMPRODUCT((T17="X")+(T20="X")+(T30="X"))>0,"X","no")

    would do that job.
    To me it looks like hawley wants to evalute a 4 element set consisting of {T17,T20,T30,"X"}.
    If so, I'll try to cope.

  8. #8
    Board Regular
    Join Date
    Apr 2002
    Posts
    197
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the help everyone. What I ended up using was this
    IF(SUMPRODUCT((T10="X")+(T20="X")+(T30="X"))>0,"X","no")

    I also found this will work but the above is less typing.
    IF((COUNTIF(T10,"X")+COUNTIF(T20,"X")+COUNTIF(T30,"X"))>0,"X","no")


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •