need help with macro in excel

InnaG

New Member
Joined
Mar 18, 2019
Messages
22
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hello,
I need help with following question:

On my spreadsheet I have the first three following columns: Record number, excluded and Name. In the NAME column there are two blocks of data that are split up by one blank row and the next one after blank has either word "Facility" or "professional". I need to find those cells and if they are found put "Z" in the corresponding cell in the column "B" which is called "excluded".

Records that will be marked as "Z" in column B need to be excluded from the data analysis.

Any help will be greatly appreciated,
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
How about a formula in the Exclude colum?
=IF(IFERROR(SEARCH("professional",C2),0)+IFERROR(SEARCH("facility",C2),0)>0,"Z","")
 
Upvote 0
How about a formula in the Exclude colum?
=IF(IFERROR(SEARCH("professional",C2),0)+IFERROR(SEARCH("facility",C2),0)>0,"Z","")
Hello,
That is a great idea. I am pretty new to the VBA still learning as I go. How can I put it in VBA?
Thank you
 
Upvote 0
Jeff's reply is not a VBA solution, it is a formula one. So you would just put that on row 2 and copy down for all rows.

If you need to add this to VBA code, you can turn on the Macro Recorder as you add this formula to your sheet to get the VBA code you need to add this formula.
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,453
Members
448,967
Latest member
grijken

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