+ Reply to Thread
Results 1 to 11 of 11

Compare cell contents with the given rnage of contents

  1. #1
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Compare cell contents with the given rnage of contents

    Hi,

    I have attached a workbook stating my problem. Any help is greatly appreciated.

    Thanks.
    SB16.
    Attached Files Attached Files
    Thanks
    Babu.S

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

    Re: Compare cell contents with the given rnage of contents

    hi Babu. assuming the number of words is separated by a comma like you illustrated, then maybe:
    =SUMPRODUCT(--(ISNUMBER(SEARCH($E$2:$E$4,A2))))=LEN(A2)-LEN(SUBSTITUTE(A2,",",""))+1

    the above checks how many matches are there in column A in column E. then compares whether it's equals to the number of words in column A. to make it into Yes & No, try:
    =IF(SUMPRODUCT(--(ISNUMBER(SEARCH($E$2:$E$4,A2))))=LEN(A2)-LEN(SUBSTITUTE(A2,",",""))+1,"yes","no")

    have a happy new year~

    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
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: Compare cell contents with the given rnage of contents

    pls see it is helping.....
    =IF(ISERROR(VLOOKUP(LEFT(A2,3),$E$2:$E$4,1,0)),"no","yes")

  4. #4
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Compare cell contents with the given rnage of contents

    Thanks Benishiryo, it works well...

    Thanks Rishikrsaw.

    Happy new year.

  5. #5
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Compare cell contents with the given rnage of contents

    Quote Originally Posted by rishikrsaw View Post
    pls see it is helping.....
    =IF(ISERROR(VLOOKUP(LEFT(A2,3),$E$2:$E$4,1,0)),"no","yes")
    Your formula gives a wrong answer if in a cell is something like aaa,zzz
    Correct answer will be no

  6. #6
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: Compare cell contents with the given rnage of contents

    @Indi_Ra


    it is working till the cell value is aaa,zzz
    if cell value is zzz,aaa then the formula will give no ....

  7. #7
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Compare cell contents with the given rnage of contents

    Quote Originally Posted by rishikrsaw View Post
    @Indi_Ra


    it is working till the cell value is aaa,zzz
    if cell value is zzz,aaa then the formula will give no ....
    What do you mean formula is good till....????
    Formula should work for all cases required by OP.
    If formula working for all cases is OK else...

  8. #8
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: Compare cell contents with the given rnage of contents

    Hi

    As per sbabu16 request (pls refer sbabu16's sheet column no b "Expected Result") all yes and column is fallowing only aaa bbb or ccc would come first in the cell as in if aaa.zzz then yes if eee.aaa then no ( pls see b5 sbabu16' comment).

    and hence I can say formula is working....


    do let me know if any thing is still Misconstrue .....

  9. #9
    Registered User
    Join Date
    09-14-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Compare cell contents with the given rnage of contents

    hi Babu. assuming the number of words is separated by a comma like you illustrated, then maybe:
    =SUMPRODUCT(--(ISNUMBER(SEARCH($E$2:$E$4,A2))))=LEN(A2)-LEN(SUBSTITUTE(A2,",",""))+1

    Happy New Year.......

  10. #10
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: Compare cell contents with the given rnage of contents

    I thing benishiryo already discuss this method by the way...........

  11. #11
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Compare cell contents with the given rnage of contents

    Quote Originally Posted by rishikrsaw View Post
    Hi

    As per sbabu16 request (pls refer sbabu16's sheet column no b "Expected Result") all yes and column is fallowing only aaa bbb or ccc would come first in the cell as in if aaa.zzz then yes if eee.aaa then no ( pls see b5 sbabu16' comment).

    and hence I can say formula is working....


    do let me know if any thing is still Misconstrue .....
    In the comment "Babu, S (S.):
    No, because it contains "eee" which is not in the database"


    Answer is NO because cell CONTAINS "eee" , this mean "eee" could be, before or after other word.
    I hope you finally understand.

+ 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: 6
    Last Post: 12-07-2012, 05:38 PM
  2. [SOLVED] Combine Cell Contents to with a [return] or [fill with spaces] between each cells contents
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2012, 11:24 PM
  3. COMPARE CELL CONTENTS
    By guy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-24-2005, 04:35 PM
  4. [SOLVED] compare cell contents
    By guy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-23-2005, 04:45 PM
  5. Function syntax to compare cell contents
    By ES in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-18-2005, 11:06 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