+ Reply to Thread
Results 1 to 17 of 17

If Cell contains "word" then assign value

  1. #1
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    If Cell contains "word" then assign value

    Basically I have columns A and columns B.
    Column A contains a list of words
    Column B is blank.
    If a cell in column A contains a word like "univ", I want the number 1 to appear in the respective row in column 2.
    If a cell in column A does not contain a word "univ", I want the number 0 to appear in the respective row in column 2.
    Many thanks.
    Last edited by undergraduate; 01-29-2010 at 09:56 PM.

  2. #2
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: If Cell contains "word" then assign value

    blank.10chars
    Last edited by undergraduate; 01-29-2010 at 09:36 PM. Reason: accident, just reedited post #1

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: If Cell contains "word" then assign value

    If a cell in column A contains a word like "univ", I want the number 1 to appear in the respective row in column 2.
    If A does not contain a word "univ", I want the number 0 to appear in the respective row in column 2
    If A = "univ", then 1 else 0 ==>

    Put in Column B:
    Please Login or Register  to view this content.
    Last edited by protonLeah; 01-29-2010 at 09:53 PM.
    Ben Van Johnson

  4. #4
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: If Cell contains "word" then assign value

    But the thing is the cell contains the word univ, it might be like "mcgill univ" and that would register as 0 with the above code


    Just got it. thanks a lot.

    =IF(ISNUMBER(SEARCH("univ",H2)),1,0)
    Last edited by undergraduate; 01-29-2010 at 09:56 PM.

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: If Cell contains "word" then assign value

    Perhaps this:
    Please Login or Register  to view this content.
    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  6. #6
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: If Cell contains "word" then assign value

    thanks thats better

  7. #7
    Registered User
    Join Date
    06-04-2013
    Location
    Nottinghamshire, England
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: If Cell contains "word" then assign value

    Hi, Sorry to bring back this old thread but can you help, I am after something very simular to this but the other way round, numbers to words. I have got that to work but can you tell me how to have multiple options, for example numbers 1 to 10 in that cell changing to different words dependant on the number.

    Cheers

  8. #8
    Registered User
    Join Date
    08-07-2013
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: If Cell contains "word" then assign value

    This equation doesnt seem to work if I am looking up if column A contains a word, I want to return a different word in column B. For example Column a says "ABC Corp" and I want column B to return "Corporation". If it return negative then it would display "LLC" any adjustments to the equation for this result?

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: If Cell contains "word" then assign value

    Do you mean like this?

    =IF(A2="ABC Corp", "Corporation", "LLC")

  10. #10
    Registered User
    Join Date
    08-07-2013
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: If Cell contains "word" then assign value

    I think there needs to be some command (That I am not aware of how to do) to have it say "if A2CONTAINS "corp", "Corporation", "LLC"

    or something to that effect. I dont think "contains" is an excel commmand though? not sure.

  11. #11
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: If Cell contains "word" then assign value

    Maybe:

    IF(ISNUMBER(FIND("Corp",A2)), "Corporation", "LLC")

  12. #12
    Registered User
    Join Date
    08-07-2013
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: If Cell contains "word" then assign value

    Thats the one. I couldnt get the combination right. that worked perfectly! Rep given!

  13. #13
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: If Cell contains "word" then assign value

    You're welcome. Glad to help out. Thanks for the feedback and the rep. Please comply with Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

  14. #14
    Registered User
    Join Date
    10-14-2013
    Location
    australia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: If Cell contains "word" then assign value

    hello,
    can somebody please help me, I am trying to make up a specific invoice spreadsheet on excel 2010.
    Its a doozy but I am sure someone out there has done something similar before. the previous replies almost explain it for me but me being a complete newb requires specifics....
    I want to be able to input
    If a certain four word text (for example "big fat blue dog") + another four word text(for example "big fat red dog") appear in column A of this row (important option - "this row" - as throughout this invoice I will have one of these two phrases if not other phrases pointing to final calculation on this particular row. meaning is there a way of containing formula to current row of operation without having to devote a row which needs to be identified (ie.A23)
    So now I want to calculate - if big fat red dog or big fat blue dog occurs in column A in this row then column M (this row) will answer - column F value (this row) multiplied by 5. the big fat red dog in this equates to 5
    the reason I want to do this is that I have a number of different activities that cost $5 and numerous others that cost more, so I need a formula that will calculate sum based on certain descriptions recognized as value and it will calculate sum in that particular same row.
    I will have at least 20 different word combinations split into 7 different values, therefore rather than dedicate a whole row for each combination text, I would like to have the same formula containing all my combination texts and their values, so I can paste it to total column (M) for each row.
    that way I can input description text in any row and it will calculate sum based on text value multiplied by value input column F in same row
    I hope I have explained myself enough for your help.
    kind regards
    Last edited by grasshouse; 10-14-2013 at 05:57 AM.

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: If Cell contains "word" then assign value

    Grasshouse,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  16. #16
    Registered User
    Join Date
    08-12-2014
    Location
    Indonesia
    MS-Off Ver
    MS Office 2013
    Posts
    2

    Re: If Cell contains "word" then assign value

    Hey Everyone, I'm new here..

    what the formula would be if i want to make commands, if a2 contains "manchester" it would be "UK", if a2 contains "london it would be "UK", too, but if a2 contains "berlin" it would be "not UK"

    thanks

  17. #17
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: If Cell contains "word" then assign value

    @masmas,
    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

+ 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