+ Reply to Thread
Results 1 to 14 of 14

Using list to check value of a cell

  1. #1
    Registered User
    Join Date
    11-07-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    6

    Post Using list to check value of a cell

    I have a problem when i'm trying to check the contents of a cell.

    The list contain part name the refers to different models of the same product.

    i.e.
    List would say ABC and that would refer to Products ABC123 & ABC456.


    =IF(ISNUMBER(FIND(mylist,d1)),"Y","N")
    However, it only seems to pick up the 1st cell in the list.

    I can use

    =OR(EXACT(mylist,d1))

    But then the list has to contain the the exact product (abc123, abc456, etc...)


    Any idea how i can get this to work?

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Using list to check value of a cell

    welcome to the forum, ewiandr. the problem is that your list contains more than 1 result. so for eg, if mylist contains:
    XYZ
    ABC

    then FIND(mylist,d1) would produce 2 results (this is called an array):
    {#VALUE!;1}
    XYZ cannot be found, so it returns an error. ABC is found in the 1st character, hence it returns 1. to get the above result, you can select that portion of the formula & press F9 to calculate

    so you need to find out if they are numbers. and you did that by doing ISNUMBER(FIND(mylist,d1)). that would produce:
    {FALSE;TRUE}

    so as long as 1 is true, it should be a "y". i need to convert them into numbers to count them. a single negative makes TRUE into -1, FALSE into 0. 2 negations make it positive. so
    --ISNUMBER(FIND(MyList,D1))
    that gives me:
    {0;1}

    i cannot do a simple SUM to add them up. because they are an array. array requires a combination of CTRL + SHIFT + ENTER if you use the SUM. you can avoid that by doing SUMPRODUCT:
    SUMPRODUCT(--ISNUMBER(FIND(MyList,D1)))

    so as long as SUMPRODUCT is 1, it will input a "y":
    =IF(SUMPRODUCT(--ISNUMBER(FIND(MyList,D1))),"Y","N")

    also, do note that FIND is case sensitive. so if your list is ABC & D1 is abc123, it won't work. use SEARCH if you want it to be non-case sensitive. another way is:
    =IF(ISNA(LOOKUP(2^15,FIND(MyList,D1))),"n","y")

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Using list to check value of a cell

    I don't know of a single formula that will return multiple results, if that is what you are trying to do. You can have a column of formulas beside the column of data that look for any product numbers containing what you're searching for, then compilation formulas using match and indirect to create a unified list. I would need to see your workbook to understand this any further.

    It's likely that I'm not really understanding what you're trying to accomplish. A potential solution for you is the following formula:
    =Match("*"&D1&"*",mylist,0)

    This will return the first row where the value in Cell D1 is found within any value contained in "mylist" (I'm assuming that is a named range?)

  4. #4
    Registered User
    Join Date
    11-07-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Using list to check value of a cell

    Thanks for the reply however both:

    =IF(SUMPRODUCT(--ISNUMBER(FIND(MyList,D1))),"Y","N")
    =IF(ISNA(LOOKUP(2^15,FIND(MyList,D1))),"n","y")

    Now add a Y for all products weaver it contains a name from the list or not?

  5. #5
    Registered User
    Join Date
    11-07-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Using list to check value of a cell

    bmxfreedom,

    I have a colum of product name and another colum that check to see if the product is contained in a list or not, adding a Y if it is and an N if it's not.

    The problem being that list contains part of the name as the list would be too big if i added all the possiblities.

    =Match("*"&D1&"*",mylist,0)
    Returns a vaule of #N/A

  6. #6
    Registered User
    Join Date
    11-07-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Using list to check value of a cell

    I've may a file with an example of what i'm trying to do, as the original file has customer sensertive data in and is way to big.
    Attached Files Attached Files

  7. #7
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 365
    Posts
    2,406

    Re: Using list to check value of a cell

    Pls check the files


    Azumi
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Using list to check value of a cell

    Oh, I see it now. Are the left 3 letters consistently 3? To make this work, you'll need a definable split between the list characters and the model numbers that follow them no matter how long they are. It's easiest with consistency, so if they are always 3 characters, the formula = if(isnumber(match(left(d1,3),mylist,0)),"Y",N") will function just fine for you (given case consistency as well...)

  9. #9
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Using list to check value of a cell

    Also, another possible part of your problem here is that your named range "mylist" is referring to a single cell at the top of the list.

  10. #10
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Using list to check value of a cell

    And actually, with that fixed, the formula =IF(SUMPRODUCT(--ISNUMBER(FIND(mylist,D2))),"Y","N") works just fine as far as I can tell without any of the weirdness of splitting up the model number with left(). Change your named range and try it out.

  11. #11
    Registered User
    Join Date
    11-07-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Using list to check value of a cell

    Thanks Azumi,

    But doesn't work when i transfer it across as some of my product has more than 3 characters.

    for example:

    Product = CPP RNC 3820 search list would be looking for RNC
    or
    Product = SUN OSS-RC 13A search list would be looking for OSS-RC

  12. #12
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Using list to check value of a cell

    Quote Originally Posted by benishiryo View Post
    =IF(SUMPRODUCT(--ISNUMBER(FIND(mylist,D1))),"Y","N")
    This is a fantastic formula benishiryo! Thanks. I'm sure to put it to use some day!

    ewiandr, don't worry about the left 3 characters. This formula works great. Just make sure your named range "mylist" is actually the whole list this time.

  13. #13
    Registered User
    Join Date
    11-07-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Using list to check value of a cell

    Quote Originally Posted by bmxfreedom View Post
    And actually, with that fixed, the formula =IF(SUMPRODUCT(--ISNUMBER(FIND(mylist,D2))),"Y","N") works just fine as far as I can tell without any of the weirdness of splitting up the model number with left(). Change your named range and try it out.
    The list was a typeo, the correct list is correct, the problem seems to be because i left some blank cells in my list to try an make it more dynamic if i need to add any more.

    Once i remove the empty cells your formula works fine, thanks...

  14. #14
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Using list to check value of a cell

    Interesting. I haven't tested this on a list with blanks, so I don't know why that would be the case. Good to know.

+ 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. Using IF to check the cell contents from a drop-down list
    By helen269 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-23-2012, 07:39 AM
  2. Check if cell is in list
    By IBMiGuy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2011, 11:02 AM
  3. check List Cell
    By Esgrimidor in forum Excel - New Users/Basics
    Replies: 12
    Last Post: 08-13-2009, 10:03 AM
  4. Check if cell entry belongs to a name list-how?
    By Bullman in forum Excel General
    Replies: 3
    Last Post: 06-05-2006, 09:45 AM
  5. How to check if an Excel cell is a list(combo box)?
    By kaka135 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-11-2005, 03:58 AM

Tags for this Thread

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