+ Reply to Thread
Results 1 to 14 of 14

Using If function to several times to get different string

  1. #1
    Registered User
    Join Date
    01-20-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Using If function to several times to get different string

    Hello,

    My problem is such. I have column values in a second worksheet that I am manipulating in the first worksheet. I am also using the find function, so this is what I ideally wish would work

    =if(find("b", secondsheet!a2), "Found B", "Found C")

    Unfortunately, the false part isn't printing and is giving me a !value error. I tried using ifs and ors but it isn't working. Help appreciated.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Using If function to several times to get different string

    You can use VLookup for that.

    Make a table in the second sheet.

    And use Vlookup to look in the table, and post the found value in sheet 1.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    01-20-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Using If function to several times to get different string

    Okay, I will try Vlookup now.

    I also tried this, =if(iserror(find("b", secondsheet!a2), "Found C", "Found B")

    but that didn't work either.

    EDIT: Vlookup doesn't do what I need.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Using If function to several times to get different string

    In that case, you better add an excel file, without confidentional information.

    Also add the desired result.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Using If function to several times to get different string

    May be this works:
    =IF(ISNUMBER(SEARCH("b",A2)),"Found B","Found C")
    Quang PT

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using If function to several times to get different string

    Not real clear what you're trying to do.

    Based on your formula, if the cell does not contain a lower case "b" anywhere within the cell then FIND( ) will return the #VALUE! error.

    For example, if the cell contains "Bill" then FIND( ) will have failed and the result will be the #VALUE! error.

    Are you sure you want to use the FIND( ) function?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Registered User
    Join Date
    01-20-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Using If function to several times to get different string

    Tony,

    My problem is to suppress the value error, how can I do that? I only have two values in that column, so I was thinking of some way to use iserror so that when find gives the error, the if conditional would assign it as a my other value. possible to do this?


    EDIT: Got it!!!

    The syntax was this, =IF(ISERROR(FIND("b", sheet2!A2)), "c", "b")
    Last edited by algebr; 01-20-2013 at 12:46 PM.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using If function to several times to get different string

    Maybe this...

    =IF(COUNTIF(secondsheet!A2,"*B*"),"Found B","Found C")

  9. #9
    Registered User
    Join Date
    01-20-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Using If function to several times to get different string

    Actually, there is another problem. My formula works if there are only two values. how could I extend it to if there were several values but I only want to pull one out, provided there is at least some name recognition.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using If function to several times to get different string

    I think we need a more detailed explanation of what you're wanting to do.

    Provide examples of what's in the cell(s) and what result(s) you expect.

  11. #11
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Using If function to several times to get different string

    To attach a sample workbook.

    When you are in Advanced reply, click on the paperclip to open the upload window.

    View Pic
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  12. #12
    Registered User
    Join Date
    01-20-2013
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Using If function to several times to get different string

    Actually, thank you everyone! I figured it out and wrote it my edit. Also used a little VBA code.

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using If function to several times to get different string

    Good deal. Thanks for the feedback!

  14. #14
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Using If function to several times to get different string

    TO mark thread "Solved"

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    Note:
    You can also thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given.
    By doing so you can add to the reputation(s) of those who helped and shared their time in helping you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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