+ Reply to Thread
Results 1 to 27 of 27

check if cell contains text from range

  1. #1
    Registered User
    Join Date
    03-13-2012
    Location
    Deventer, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    64

    check if cell contains text from range

    Hi There,
    does anybody know a simple formula to check (e.g. by means of TRUE/FALSE) whether the green cell contains text which is present in the yellow range (see example enclosed)?
    i.o.w. the green cell currnetly reads 'ain', the check should hence return TRUE as the yellow range comprises trAIN..

    Kind regards,
    Niels
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    Try this:

    =INDEX(C2:C9,MATCH("*"&E3,C2:C9,0),0)<>""
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-13-2012
    Location
    Deventer, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: check if cell contains text from range

    Hi there, this formula answers the question, however just now I understand I made a mistake in my original post.
    I'm actually looking for a formula which would return TRUE in case the green cell would read 'trainstation'.. So the check would be; whether the text from the range is part of the green cell..

    Anybody an idea?

    Regards Niels

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    I can't help you with this very different request, sorry, as I think it might need VBA.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,245

    Re: check if cell contains text from range

    Try

    =IF(SUMPRODUCT(--(ISNUMBER(SEARCH(E3,C2:C9)))),"TRUE","FALSE")

  6. #6
    Registered User
    Join Date
    03-13-2012
    Location
    Deventer, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: check if cell contains text from range

    sorry John,. it doesn't work.. It works for train, but not for trainstation..

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,245

    Re: check if cell contains text from range

    Works for me!!!

    =IF(SUMPRODUCT(--(ISNUMBER(SEARCH(E3,C2:C9))));"TRUE";"FALSE")

  8. #8
    Registered User
    Join Date
    03-13-2012
    Location
    Deventer, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: check if cell contains text from range

    Hi John, I do work in a different language (Dutch) and am translating formulas and text marks (, for ; etc), but somehow it doesn't work for me.. Can you perhaps upload the spreadsheet with the working formula?

    Regards Niels

  9. #9
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: check if cell contains text from range

    You might use a formula like this
    =COUNT(INDEX(SEARCH(C2:C9,E3),))<>0
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    Quote Originally Posted by nielsb View Post
    Hi John, I do work in a different language (Dutch) and am translating formulas and text marks (, for ; etc), but somehow it doesn't work for me.. Can you perhaps upload the spreadsheet with the working formula?

    Regards Niels
    I think it would be better if you uploaded the workbook where it isn't working.

  11. #11
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,915

    Re: check if cell contains text from range

    Or ...

    =SUMPRODUCT(COUNTIF(E3,"*"&C2:C9&"*"))>0

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,245

    Re: check if cell contains text from range

    See attached ...
    Attached Files Attached Files

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    John - my interpretation is that trainstation needs to be in the green cell and train in the list.

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,245

    Re: check if cell contains text from range

    Ali,
    I don't think so ......

    the green cell currently reads 'ain', the check should hence return TRUE as the yellow range comprises trAIN..

  15. #15
    Registered User
    Join Date
    03-13-2012
    Location
    Deventer, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: check if cell contains text from range

    John, I see your view, however that doesn't fit with my problem..

    Phuocam's formula works perfect however. The prombelm with xlnitwit's formula is that blank cells are also accepted, which is not ok in my situation.
    All thanks for helpoing out!

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    Quote Originally Posted by JohnTopley View Post
    Ali,
    I don't think so ......
    I do! From post #3:
    I'm actually looking for a formula which would return TRUE in case the green cell would read 'trainstation'. So the check would be; whether the text from the range is part of the green cell.
    Looks like Phuocam got there.

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  18. #18
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: check if cell contains text from range

    Quote Originally Posted by nielsb View Post
    The prombelm with xlnitwit's formula is that blank cells are also accepted, which is not ok in my situation.
    Blank cells where? If any cell in C2:C9 is blank, both formulas return TRUE for any value in E3 as far as I can see. To fix that you might use
    =COUNT(INDEX(SEARCH(C2:C9,E3)*(1/LEN(C2:C9)),))<>0
    Last edited by xlnitwit; 12-29-2016 at 09:17 AM.

  19. #19
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,245

    Re: check if cell contains text from range

    I don't understand ...

    with "ain" in the green cell (E3)

    =SUMPRODUCT(COUNTIF(E3,"*"&C2:C9&"*"))>0

    returns FALSE

    ???????

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    with "ain" in the green cell (E3)
    E3 = trainstation

    The OP shifted the goalposts in post #3.

  21. #21
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,245

    Re: check if cell contains text from range

    @Ali,

    Doh!!!!

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    Quote Originally Posted by JohnTopley View Post
    @Ali,

    Doh!!!!
    Hehehe!!!

  23. #23
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    This thread remains unsolved. The OP us still looking for a 'simple' formula solution.

  24. #24
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,894

    Re: check if cell contains text from range

    So if I understood it right...

    1. Range may contain blank
    2. If any cell in range contains string that is part of full string (Ex. "trainstaion"), it should return True

    Following formula should work.
    =SUMPRODUCT(--(ISNUMBER(SEARCH(C2:C9,E3)))*(C2:C9<>""))>0

    See sample workbook (range extended).
    Attached Files Attached Files

  25. #25
    Registered User
    Join Date
    12-19-2016
    Location
    India
    MS-Off Ver
    Office 2007
    Posts
    7

    Re: check if cell contains text from range

    =IF(IFERROR(FIND(E5,C5,1),0)>0,"Yes","No")
    Last edited by AliGW; 12-30-2016 at 03:43 AM.

  26. #26
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: check if cell contains text from range

    What would be the definition of simple? And where did the OP go? I posted a revised formula earlier but there has been no feedback, which makes it hard to proceed.

  27. #27
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: check if cell contains text from range

    The OP started two further threads which were closed as duplicates with links back here. Hopefully he'll be back some time today to pick this up. The words 'simple formula' were used in one of those closed posts - he doesn't want VBA.

+ 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. [SOLVED] Check text in adjacent cell and accordingly fill text from master reference
    By bcmehta in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-11-2016, 08:15 AM
  2. [SOLVED] If a cell is contained in a range, then WORD, if not go check in another range...
    By Marta Garcia in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-15-2016, 07:24 AM
  3. Check cell contains if contains text check another column.
    By thequiff in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-13-2013, 07:29 AM
  4. [SOLVED] If Or statement to check cell text and delete entire row if text is found
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2013, 11:46 AM
  5. Check if cell range has value and return text
    By Postlki1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-20-2013, 04:52 AM
  6. [SOLVED] Makro with if condition to check for numeric and text values in a cell range
    By Postlki1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2013, 07:53 AM
  7. Replies: 2
    Last Post: 03-18-2013, 12:43 PM

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