+ Reply to Thread
Results 1 to 13 of 13

IF statement to return value when cell contains a specific word finding "1" for "10"

  1. #1
    Registered User
    Join Date
    06-12-2014
    Posts
    9

    IF statement to return value when cell contains a specific word finding "1" for "10"

    My IF statement should return a given value if a cell contains a specific word. The problem is the formula sees "DA-10" as "DA-1", and "DA-20" as "DA-2". I want the cell containing "DA-10" to return "7.02" but it is returning "4.42", the value for "DA-1", since the cell does in fact contain that string of text. I've tried it with and without wildcards but can't figure out how to make it differentiate between 1 and 10, 2 and 20, etc.

    Please Login or Register  to view this content.
    Last edited by arisphaedrus; 06-12-2014 at 11:47 AM.

  2. #2
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    Hi there,
    canīt it be done with VLOOKUP()?
    Regards
    Miroslav R.

    (If You like my solutions, feel free to add reputation.)

  3. #3
    Registered User
    Join Date
    06-12-2014
    Posts
    9

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    Maybe so... I'm not that comfortable using VLOOKUP() but here's good opportunity to give it a go. I'll try it.

  4. #4
    Registered User
    Join Date
    06-12-2014
    Posts
    9

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    I can't seem to make it work. My sheet is not organized in neat columns that will make it work. The values I want returned are not in the same row as the cell I'm searching in. Any other ideas?

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    Please attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  6. #6
    Registered User
    Join Date
    06-12-2014
    Posts
    9

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    I'd like the formula in column A to return the correct value in column P based on the text contained in column C. =IF(ISNUMBER(SEARCH() works until the formula confuses "DA-10" with (DA-1), and then returning the incorrect value.
    Attached Files Attached Files

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    Try this

    =IFERROR(VLOOKUP(LEFT(C2,FIND(" ",C2)-1)&"*",$O$2:$P$17,2,0),VLOOKUP(C2,$O$2:$P$17,2,0))

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    or
    =LOOKUP(10^99,SEARCH($P$2:$P$17,D2),$Q$2:$Q$17)
    should work
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    Quote Originally Posted by martindwilson View Post
    or
    =LOOKUP(10^99,SEARCH($P$2:$P$17,D2),$Q$2:$Q$17)
    should work
    maybe like this?

    =LOOKUP(10^99,SEARCH($O$2:$O$17,C2),$P$2:$P$17)

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    ah i inserted a column to test
    =LOOKUP(10^99,SEARCH($O$2:$O$17,C2),$P$2:$P$17) is correct

  11. #11
    Valued Forum Contributor Saarang84's Avatar
    Join Date
    02-19-2009
    Location
    Chennai, India
    MS-Off Ver
    XL 2003 to 2010
    Posts
    812

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    Hi,

    Instead of your very very BIG IF condition, you can use the below formula to fetch the values in column A.

    If your Excel version is 2007 and above use,
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If your Excel version is prior to 2007 use,
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Copy down this formula for all rows and change the worksheet ranges as required.
    Last edited by Saarang84; 06-12-2014 at 10:23 PM.
    If my assistance has helped, there is a reputation icon * on the left hand corner below the post - you can show your appreciation to the user who has helped in resolving your requirement.

    If your requirement has been solved please mark your thread as Solved.
    In the menu bar above the very first post, select Thread Tools, then select "Mark this thread as Solved".

    Kindly use [FORMULA] or [CODE] tags when posting your code.

    Regards,
    Sarang

  12. #12
    Registered User
    Join Date
    06-12-2014
    Posts
    9

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    This is great! Multiple solutions all of which seem to work and are much better than my huge original IF statement. Thank you all very much. Now I'm going to spend some time deciphering these and figuring out how you did it.

  13. #13
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: IF statement to return value when cell contains a specific word finding "1" for "10"

    You're welcome and thank you for the feedback!

    Please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

+ 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: 5
    Last Post: 01-23-2014, 11:02 AM
  2. Return "green", "yellow" or "red" from date/age and priority ranking
    By Cantaloop in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-04-2013, 12:12 AM
  3. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM
  4. Replies: 3
    Last Post: 02-16-2011, 02:55 PM
  5. Replies: 3
    Last Post: 12-14-2006, 01:36 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