# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  If Cell contains "word" then assign value

## undergraduate

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.

----------


## undergraduate

blank.10chars

----------


## protonLeah

> 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.
```

----------


## undergraduate

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)

----------


## Ron Coderre

Perhaps this:



```
Please Login or Register  to view this content.
```


Does that help?

----------


## undergraduate

thanks thats better

----------


## Car7os

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

----------


## ballerado

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?

----------


## JOHN H. DAVIS

Do you mean like this?

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

----------


## ballerado

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.

----------


## JOHN H. DAVIS

Maybe:

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

----------


## ballerado

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

----------


## JOHN H. DAVIS

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.

----------


## grasshouse

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

----------


## arlu1201

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.

----------


## masmas

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

----------


## protonLeah

@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.

----------

