+ Reply to Thread
Results 1 to 17 of 17

Need IF Statement to check text

  1. #1
    Registered User
    Join Date
    01-05-2023
    Location
    Boston
    MS-Off Ver
    Office 365
    Posts
    53

    Smile Need IF Statement to check text

    Hello ! Happy new year!
    Looking for some help to write two IF statements to check for text in a range of cells and then return a value. Attached is my sample excel file and the two questions I have are shown on the file... Sample IF statement.xlsx
    I tried a few methods found online but none were exactly working...

    Note that I have lookup formulas where the #N/A are shown on the excel file, will the IF statement still check or work for that?
    THANK YOU SO MUCH!



    IF Function to check if column A to N does not contain any Yes or Yes.., return 1, otherwise show blank.

    If column A to N contains ONLY Yes or Yes.., return 1, otherwise show blank.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,100

    Re: Need IF Statement to check text

    IF Function to check if column A to N does not contain any Yes or Yes.., return 1, otherwise show blank.
    =IF(COUNTIF(A2:N2,"*"&"yes"&"*")=0,1,"")
    does not contain a yes


    If column A to N contains ONLY Yes or Yes.., return 1, otherwise show blank
    =IF(COUNTIF(A2:N2,"*"&"yes"&"*")>0,1,"")
    does contain a YES

    what does ONLY contain a yes - what other content is allowed
    Attached Files Attached Files
    Last edited by etaf; 01-05-2023 at 02:54 PM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Valued Forum Contributor
    Join Date
    11-29-2022
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    435

    Re: Need IF Statement to check text

    In cell O2:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In cell P2:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-05-2023
    Location
    Boston
    MS-Off Ver
    Office 365
    Posts
    53

    Re: Need IF Statement to check text

    Quote Originally Posted by etaf View Post
    =IF(COUNTIF(A2:N2,"*"&"yes"&"*")=0,1,"")
    does not contain a yes



    =IF(COUNTIF(A2:N2,"*"&"yes"&"*")>0,1,"")
    does contain a YES

    what does ONLY contain a yes - what other content is allowed
    Thanks! For this statement, I need it to show a 1 when there is "Yes" or "Yes," or " Yes..." there could be "Unsure" "Maybe" but I don't care as long as there are Yes or Yes,... I tried your formula it did not work when there are "No" and "Yes" both in the range.

  5. #5
    Valued Forum Contributor
    Join Date
    11-29-2022
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    435

    Re: Need IF Statement to check text

    Nothing in your instructions talking about a No. Can add another piece to that:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,100

    Re: Need IF Statement to check text

    I tried your formula it did not work when there are "No" and "Yes" both in the range.
    can you explain / give examples

    I am just counting the range to see if there is a YES in the contents anywhere -
    so
    Yes, sometimes
    is a yes
    this is a great timne and YES i will be coming back
    will also see as a yes


    Unsure or Maybe - will not be counted as no YES in the cell

    row 6 in your example has a
    NO in A6
    YES in D6

    so as i'm only counting YES - ignoring everything else

    If there is a NO anywhere in the range - then that counts as a blank - regardless of YES

    may need some expected results in your sample and explanation why

  7. #7
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,466

    Re: Need IF Statement to check text

    1 If does not contain any Yes, please try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    1 If all columns contain Yes (#N/A excluded), please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    1 If all columns contain Yes (#N/A included), please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-05-2023
    Location
    Boston
    MS-Off Ver
    Office 365
    Posts
    53

    Re: Need IF Statement to check text

    Quote Originally Posted by etaf View Post
    can you explain / give examples

    I am just counting the range to see if there is a YES in the contents anywhere -
    so

    is a yes

    will also see as a yes


    Unsure or Maybe - will not be counted as no YES in the cell

    row 6 in your example has a
    NO in A6
    YES in D6

    so as i'm only counting YES - ignoring everything else

    If there is a NO anywhere in the range - then that counts as a blank - regardless of YES

    may need some expected results in your sample and explanation why
    I just built out more results in my sample and it looks like it is working!!!! My brain is fried so excuse any confusions I might have caused. The actual data set I am working on is SO much larger than the sample. I think both formulas you sent me works well! Thank you!!

  9. #9
    Registered User
    Join Date
    01-05-2023
    Location
    Boston
    MS-Off Ver
    Office 365
    Posts
    53

    Re: Need IF Statement to check text

    thank you! I think I got the answer I needed.

  10. #10
    Registered User
    Join Date
    01-05-2023
    Location
    Boston
    MS-Off Ver
    Office 365
    Posts
    53

    Re: Need IF Statement to check text

    Quote Originally Posted by thomglea View Post
    In cell O2:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In cell P2:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    thank you for your response. I think I got it!

  11. #11
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,100

    Re: Need IF Statement to check text

    you are welcome

  12. #12
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,466

    Re: Need IF Statement to check text

    Thanks for your feedback. Glad you found the right formula.

    Please consider adding reputation to all helpers, who you think they deserved because of the help provided.
    If you want to, please click *Add reputation at the bottom left of their answers.

  13. #13
    Registered User
    Join Date
    01-05-2023
    Location
    Boston
    MS-Off Ver
    Office 365
    Posts
    53

    Re: Need IF Statement to check text

    Quote Originally Posted by etaf View Post
    you are welcome
    Hi - I have one additional question. I am thinking to add a column to count the number of Yes or yes...that showed up in the range of cells so it returns a numeric value. If yes or yes...showed up three times, I want to see a 3 in my column. what would that formula be? thank you again!!

  14. #14
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,100

    Re: Need IF Statement to check text

    pretty much the same one, that we are using to count the cells with a YES - and then using a =0 >0 to show true / false
    so
    =COUNTIF(A2:N2,"*"&"yes"&"*")

  15. #15
    Registered User
    Join Date
    01-05-2023
    Location
    Boston
    MS-Off Ver
    Office 365
    Posts
    53

    Re: Need IF Statement to check text

    Quote Originally Posted by etaf View Post
    pretty much the same one, that we are using to count the cells with a YES - and then using a =0 >0 to show true / false
    so
    =COUNTIF(A2:N2,"*"&"yes"&"*")
    worked like magic! thank you so much. I added reputation for your great work!

  16. #16
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,100

    Re: Need IF Statement to check text

    you are welcome, thanks for the rep

  17. #17
    Registered User
    Join Date
    01-05-2023
    Location
    Boston
    MS-Off Ver
    Office 365
    Posts
    53

    Re: Need IF Statement to check text

    Quote Originally Posted by HansDouwe View Post
    Thanks for your feedback. Glad you found the right formula.

    Please consider adding reputation to all helpers, who you think they deserved because of the help provided.
    If you want to, please click *Add reputation at the bottom left of their answers.
    Yes I did already. thanks for your response!!! you guys made my day. This forum is an amazing resource!

+ 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] IF Statement to check for blanks first
    By drewberts in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-30-2014, 05:06 PM
  2. [SOLVED] If Statement to Check if a Particular Row is Selected
    By excel6000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-18-2014, 04:03 PM
  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. I thought this would be easy (check for text, check error, do math)
    By bruinsrme in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-14-2013, 01:18 AM
  6. 2 check if statement
    By richy1066 in forum Excel General
    Replies: 4
    Last Post: 10-11-2010, 04:13 AM
  7. If statement check
    By Royalmathmtcs in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 12-06-2008, 03:16 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