If contains "like" put value in another cell

emukiss10

Board Regular
Joined
Nov 17, 2017
Messages
201
HI Guys!

simple one but I cannot get there :/

If column B contains text like "10,00%" (Ex. "Discount 10,00% was granted")

insert number 21 in column Q of the same row.

Output should look like this

ABOPQ
1BLA BLA 10,00% BLA21
2BLA BLA BLA
310,00%21
4BLA BLA BLA

<tbody>
</tbody>

Best Regards!
W.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Try this formula in Q1:
Code:
=IF(ISNUMBER(SEARCH("10,00%",B1)),21,"")
 
Upvote 0
In VBA please.. Its a part of a macro
In the future, you want to be sure to mention that in your original post so people don't waste time coming up with solutions that don't work for you (not a big deal for this one, as this one was not very complex, but that might not always be the case).

Try this code:
Code:
Sub MyMacro()

    Dim lrow As Long
    Dim r As Long
    
    Application.ScreenUpdating = False
    
'   Find last row in column B with data
    lrow = Cells(Rows.Count, "B").End(xlUp).Row
    
'   Loop through all rows
    For r = 1 To lrow
'       Check entry in column B
        If InStr(Cells(r, "B"), "10,00%") > 0 Then Cells(r, "Q") = 21
    Next r
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0
Thank You it works Perfectly! And forgive my notBeSpecific thing.. Ill keep Your advice in mind next time Ill post.

Best Wishes!
W.
 
Upvote 0
You are welcome.
Glad we were able to help and it works for you.:)
 
Upvote 0

Forum statistics

Threads
1,213,485
Messages
6,113,931
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top