+ Reply to Thread
Results 1 to 4 of 4

IF statement - checking if text appears in a range, then applying 1, 2 or 3

  1. #1
    Registered User
    Join Date
    08-26-2013
    Location
    Australia
    MS-Off Ver
    Excel 365
    Posts
    2

    IF statement - checking if text appears in a range, then applying 1, 2 or 3

    Hi guys,

    as my title somewhat poorly describes, I would like to test a cell (k14) to see if that word appears anywhere within a range of cells on another tab.

    If it appears in the first third of the tab, then I would like "1" to be the result, if the word appears in the next third a "2" and the final third a "3".

    If the cell does not appear at all in the range, I would like a "1" to be displayed.

    Am I on the right track here?

    =IF(COUNTIF(Zones!#REF!,K14),1,IF(COUNTIF(Zones!A112:A329,K14),2,IF(COUNTIF(Zones!A330:A939,K14),3)))

    Many thanks in advance!!

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,843

    Re: IF statement - checking if text appears in a range, then applying 1, 2 or 3

    Pretty close. Try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Registered User
    Join Date
    08-26-2013
    Location
    Australia
    MS-Off Ver
    Excel 365
    Posts
    2

    Re: IF statement - checking if text appears in a range, then applying 1, 2 or 3

    Perfect - thanks so much!!!

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: IF statement - checking if text appears in a range, then applying 1, 2 or 3

    The >0 is redundant,

    Hence, a tad shorter...

    =IF(COUNTIF(Zones!$A$1:$A$111,K14),1,IF(COUNTIF(Zones!$A$112:$A$329,K14),2,IF(COUNTIF(Zones!$A$330:$A$939,K14),3,"Not found")))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

+ 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. Replies: 3
    Last Post: 10-02-2012, 06:17 AM
  2. If Statement checking range of cells
    By Lockeitivity in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-15-2010, 01:10 PM
  3. Applying an IF statement to a range
    By scottb in forum Excel General
    Replies: 1
    Last Post: 11-29-2009, 08:00 AM
  4. Applying If statement to wide range of cells
    By MountainGoat in forum Excel General
    Replies: 3
    Last Post: 08-21-2008, 10:56 AM
  5. Counting each time text appears in range???
    By Simon Lloyd in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-09-2006, 08: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