+ Reply to Thread
Results 1 to 20 of 20

Return a Result Based on First Word of Cell

  1. #1
    Registered User
    Join Date
    12-08-2014
    Location
    Tamuning, Guam
    MS-Off Ver
    2007/2010
    Posts
    12

    Return a Result Based on First Word of Cell

    Hello. Would anyone be able to help me with a formula that returns a result based on the first word of a cell? I have a formula set up to return results based on five words should they appear in said cell, however, it returns results according to the order my formula lists the the words being searched for. I need it to return results based on the first word of the cell it is searching in. Thanks in advance.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Return a Result Based on First Word of Cell

    List your five words, together with what you want them to return, in a small table somewhere - suppose this is in X1:Y5. Then you can use this formula:

    =VLOOKUP(LEFT(A1,FIND(" ",A1)-1),$X$1:$Y$5,2,0)

    assuming your string is in cell A1.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    12-08-2014
    Location
    Tamuning, Guam
    MS-Off Ver
    2007/2010
    Posts
    12

    Re: Return a Result Based on First Word of Cell

    Hi Pete, thank you for your response. I will try this now and hope it works!

  4. #4
    Registered User
    Join Date
    12-08-2014
    Location
    Tamuning, Guam
    MS-Off Ver
    2007/2010
    Posts
    12

    Re: Return a Result Based on First Word of Cell

    Still having a little problem. And maybe it will help if I understand the formula. Your formula says to vertical look up the left of cell A1 and find the first " " (to me this means blank space so I am a little confused about that part), then I don't exactly understand the A1)-1 part. I get the next part which is telling it to look up the information on said table. Then I don't understand what the 2,0 is for.

    And, it is six words with six respective returns now, no longer five, I added a category.

    I plugged in the formula, created a table (with six not five), and typed in one of the words in the cell it should be searching in, and it returns #value error.

  5. #5
    Registered User
    Join Date
    06-04-2012
    Location
    Albuquerque
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Return a Result Based on First Word of Cell

    The formula has a slight typo. It should read
    Please Login or Register  to view this content.
    .

    The " " represents the space we're assuming you're using to separate the words in your list. The "2,0" means return the value for the nearest match to the first word in your column. However, VLOOKUPs on TEXT values will not work unless they are an exact match.

    Since you've added a word to your list, you'll need to change the range in your VLOOKUP from $X$1:$Y$5 to $X$1:$Y$6.

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: Return a Result Based on First Word of Cell

    attach sample excel file
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  7. #7
    Registered User
    Join Date
    12-08-2014
    Location
    Tamuning, Guam
    MS-Off Ver
    2007/2010
    Posts
    12

    Re: Return a Result Based on First Word of Cell

    Hi. Thank you for responding. Yes, I changed the VLOOKUP from five to six. It still returns the error. Help...

  8. #8
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 365
    Posts
    2,406

    Re: Return a Result Based on First Word of Cell

    Attach your workbook with sample data and explain your desired results, click "Go Advanced" button and find Paperclip Button to attach your file.

    Thanks

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Return a Result Based on First Word of Cell

    From your description in Post #4, it seems that you just entered one word in A1 to test it, whereas I thought you would be entering a group of words with spaces in between. For a single word (and/or multiple words), you should make this amendment:

    =VLOOKUP(LEFT(A1&" ",FIND(" ",A1&" ")-1),$X$1:$Y$6,2,0)

    If you are still having problems, then attach a sample workbook, as others have requested - the FAQ describes how to.

    Hope this helps.

    Pete

  10. #10
    Registered User
    Join Date
    12-08-2014
    Location
    Tamuning, Guam
    MS-Off Ver
    2007/2010
    Posts
    12

    Re: Return a Result Based on First Word of Cell

    Okay. I sure hope I attached it. It looked like I did but I do not see anywhere here that shows it is attached to this message... So sorry everyone, I am new to this. Please let me know if there is an attachment, I wrote further details on the spreadsheet. Thanks always for all of your help.
    Attached Files Attached Files

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,747

    Re: Return a Result Based on First Word of Cell

    Array enter this formula in N3:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    (Array enter means commit the formula with Ctrl + Shift + Enter.)

    Then fill down and across.

    I don't knowingly upload macro workbooks (*.xlsm files). I uploaded this one before I noticed. The return file is attached as an *.xlsx file.

    Does this do what you want?

  12. #12
    Registered User
    Join Date
    12-08-2014
    Location
    Tamuning, Guam
    MS-Off Ver
    2007/2010
    Posts
    12

    Re: Return a Result Based on First Word of Cell

    Hello FlameRetired. Thank you for your help. I should have explained better, the columns my table is in does not have anything to do with the formula I need. I need the formula to sit in cell H3 (all all cells below) and search for the word(s) in cell C3. Column C is the "finding" column, which will sometimes (more than likely) have multiple findings listed. I need it to look at the first word of that cell, see if it is one of the six categories, and return the respective word for said category. I will play with your formula a bit as well, but if you have a quick fix, I would truly appreciate it. Thanks!

  13. #13
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 365
    Posts
    2,406

    Re: Return a Result Based on First Word of Cell

    Hope this works, pls see the file attach..

    regards
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    12-08-2014
    Location
    Tamuning, Guam
    MS-Off Ver
    2007/2010
    Posts
    12

    Re: Return a Result Based on First Word of Cell

    Hi Azumi. Oh my gosh I think it is so close. Only thing is, I want it to look for said word at the left most part of the cell (C3), and return a certain word. For instance, it should look up "term" and if it finds that at the furthermost left of cell C3, it should return the word "Review" in H3. So I need it to find "term" and return "Review", find "not" and return "Collect", find "over" and return "Credit Acct", find "class" and return "Adjust", find "adjust" and return "No Action", find "transfer" and return "Offset".

  15. #15
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 365
    Posts
    2,406

    Re: Return a Result Based on First Word of Cell

    Ooops sorry Im miseed that one:

    =IFERROR(LOOKUP(2^15,SEARCH($N$14:$N$19,SUBSTITUTE(SUBSTITUTE(LEFT($C3,SEARCH(" ",$C3,1)-1),"",""),"","")),$O$14:$O$19),LOOKUP(2^15,SEARCH($N$14:$N$19,SUBSTITUTE(SUBSTITUTE($C3,"",""),"","")),$O$14:$O$19))

    put in H3 and dragged down
    Attached Files Attached Files

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

    Re: Return a Result Based on First Word of Cell

    have you tried
    =IFERROR(LOOKUP(1,SEARCH($N$14:$N$19,C3),$O$14:$O$19),"no action")
    "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

  17. #17
    Registered User
    Join Date
    12-08-2014
    Location
    Tamuning, Guam
    MS-Off Ver
    2007/2010
    Posts
    12

    Re: Return a Result Based on First Word of Cell

    Azumi YOU FREAKING ROCK!!!!! Thank you so much. That worked perfectly. And now, I want to understand the formula and its functions so I can do it myself if ever needed similar in the future. Thank you again. And thank you everyone.

  18. #18
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,747

    Re: Return a Result Based on First Word of Cell

    Quote Originally Posted by sillyevi View Post
    .......I need it to look at the first word of that cell, see if it is one of the six categories, and return the respective word for said category. I will play with your formula a bit as well, but if you have a quick fix, I would truly appreciate it. Thanks!
    I missed the H3 part. The formula(s) still work. Array enter this one in H3 and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Hope this works.

  19. #19
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,747

    Re: Return a Result Based on First Word of Cell

    Quote Originally Posted by martindwilson View Post
    have you tried
    =IFERROR(LOOKUP(1,SEARCH($N$14:$N$19,C3),$O$14:$O$19),"no action")
    Good one, Martin. Thanks for sharing this one.

  20. #20
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 365
    Posts
    2,406

    Re: Return a Result Based on First Word of Cell

    Quote Originally Posted by sillyevi View Post
    Azumi YOU FREAKING ROCK!!!!! Thank you so much. That worked perfectly. And now, I want to understand the formula and its functions so I can do it myself if ever needed similar in the future. Thank you again. And thank you everyone.
    Thanks for you r feedback..

    Cheers

+ 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. From Spread Sheet to Micro Word based off result of formula in a cell.
    By Butterfree-sq in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-29-2014, 02:55 PM
  2. [SOLVED] Return result from a table based on two other cell results
    By jgregory43 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-30-2013, 11:01 PM
  3. [SOLVED] Return a word, based off the value (>100) of another cell??? (2007)
    By spectralfire in forum Excel General
    Replies: 4
    Last Post: 07-27-2012, 12:16 PM
  4. [SOLVED] Advanced formula - Return result & Show Cell Reference of result
    By Irv in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-05-2006, 10:40 PM
  5. return array result in cell based on comparing dates
    By Ruthki in forum Excel Formulas & Functions
    Replies: 51
    Last Post: 09-06-2005, 12:05 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