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.
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
Try this formula in Q1:
Code:
=IF(ISNUMBER(SEARCH("10,00%",B1)),21,"")
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

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
 

emukiss10

Board Regular
Joined
Nov 17, 2017
Messages
201
Thank You it works Perfectly! And forgive my notBeSpecific thing.. Ill keep Your advice in mind next time Ill post.

Best Wishes!
W.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
You are welcome.
Glad we were able to help and it works for you.:)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,519
Messages
5,596,634
Members
414,082
Latest member
sasmita

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
Top