If a cell contains certain word.

jevi

Board Regular
Joined
Apr 13, 2010
Messages
219
Hi All,

I'm trying to do this formul but is not working.

=IF(ISNUMBER(SEARCH("*LR 10*";A2));"M01";B2)

so in column A2 I have the long desription of the loan and I want to find the ones that contain "LR 10", and if this is true to put in cell C2 "M01" otherwise the value that is in cell B2. But is not giving the result I want.

So I need help...thank you:)
 
Last edited:

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
41,833
Office Version
365
Platform
Windows
Hmm, seems to work for me. In what way is it "not giving the result I want"?
Some sample data maybe?

Also, whilst they won't do any harm, you don't need the asterisks in that formula.

Note that my formula delimiter is "," not ";" like yours.

Excel Workbook
ABCD
2Some long description including LR 10 and other textxxx
3Some long description including LR 11 and other textyyyyyyyyy
SEARCH
 
Last edited:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,569
Office Version
365
Platform
Windows
If the data in col A has come from a website or some other 3rd party software, the spaces maybe non-breaking spaces, in which case try
=IF(ISNUMBER(SEARCH("LR?10",A2)),"M01",B2)
Although this will pick-up any instance where you have LR & 10 separated by a single character.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
41,833
Office Version
365
Platform
Windows
If the data in col A has come from a website or some other 3rd party software, the spaces maybe non-breaking spaces,...
Good point, and we could target that &/or space specifically with

=IF(ISNUMBER(SEARCH("LR 10",SUBSTITUTE(A2,CHAR(160)," "))),"M01",B2)
 

jevi

Board Regular
Joined
Apr 13, 2010
Messages
219
Thank you to all of you for the answers. Now that I did the test from the home computer is working my formula but because I wrote the test LR 10 in the excel file while at office is not working. The test that i have in the office is in txt extracted from another program so I will use "?" and the other formula. I will try on monday and let you know if it is working, but I guess was not working as Pluff said as it is a text from another program.

Have a nice weekend all of you.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,569
Office Version
365
Platform
Windows
If you are likely to something like LRP10 in the cell and it should return B2 rather than "M01", then you are better off using Peter's code.
 

Forum statistics

Threads
1,078,520
Messages
5,340,941
Members
399,399
Latest member
SravanaSandhya

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top