+ Reply to Thread
Results 1 to 7 of 7

IF Statement to check ALL columns for certain numbers

  1. #1
    Registered User
    Join Date
    12-26-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Exclamation IF Statement to check ALL columns for certain numbers

    Hello,

    This is likely quite an easy task but I am having difficulty figuring it out and would really appreciate assistance.

    I have multiple columns (i.e. A through J) that contain specific numbers (i.e. 62, 31, 44, 55, 78). I would like to check ALL of these columns for certain numbers (i.e. just 62 AND/OR 62 and 31) and have either a 0 or 1 populate into another cell.

    Example:

    IF A:J contains 62 AND/OR 31 AND/OR 44 THEN Cell K equals 1 else 0.

    How should this statement be written? How do I go about writing this code?

    THANK YOU!!

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Need help with an IF Statement... at least that is what I think I need help with!!! :(

    One way could be this.

    Assuming that your data starts in row 1, then in K1 and copy down use this.

    PHP Code: 
    =IF(OR(COUNTIF(A1:J1,62),COUNTIF(A1:J1,31),COUNTIF(A1:J1,44)),1,0
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    12-26-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need help with an IF Statement... at least that is what I think I need help with!!! :(

    It worked! I have one more question though: What do I do if I have close to 150 different numbers to consider? Would it work if I listed the numbers on a separate sheet and then in your statement

    =IF(COUNTIF(A1:J1,Sheet2!A1:A150),"1","0")


    I tried the above and it doesn't seem to work.

    THANK YOU!!!!!! You have saved me a great deal of time and effort

  4. #4
    Registered User
    Join Date
    12-26-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Exclamation Re: Need help with an IF Statement... at least that is what I think I need help with!!! :(

    It worked! I have one more question though: What do I do if I have close to 150 different numbers to consider? Would it work if I listed the numbers on a separate sheet and then in your statement

    =IF(COUNTIF(A1:J1,Sheet2!A1:A150),"1","0")


    I tried the above and it doesn't seem to work.

    THANK YOU!!!!!! You have saved me a great deal of time and effort

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Need help with an IF Statement... at least that is what I think I need help with!!! :(

    A little ungly but works...

    Please Login or Register  to view this content.
    In K1 and copy down.

  6. #6
    Registered User
    Join Date
    12-26-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need help with an IF Statement... at least that is what I think I need help with!!! :(

    That looks like it works, I can't thank you enough! you are a life saver!

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: IF Statement to check ALL columns for certain numbers

    ..............

+ 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