Automate deleting rows containing a specific word in a specific column

tompepper

New Member
Joined
Mar 19, 2023
Messages
11
Office Version
  1. 2013
Platform
  1. Windows
Hi,

I have several thousand files where I need to delete rows containing a specific word in a specific column, e.g. if the cell contains the word forecast in column C.
I also need to check if cells in another column contains a number, period and space before a word and if so remove the number, period and space but leave the word, and not delete the row.

Please can someone help me with a macro to do this automatically without needing me to manually open each file.

Thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Do you mean several thousand workbooks?

How many worksheets does each of these workbooks have or does it vary?

Does the cell in column C just contain the word 'forecast' or is the word embedded in a string?

Regarding the second issue, (a number, period and space), can you please give us an example of the data.
Does the number vary?
 
Upvote 0
several thousand workbooks, all .csv files
one worksheet in each
forecast can be on its own or in a string
number, period space - the number can varyexample, 1. allen or 2. pete

Thanks
 
Upvote 0
several thousand workbooks, all .csv files
one worksheet in each
forecast can be on its own or in a string
number, period space - the number can varyexample, 1. allen or 2. pete

Thanks
Are all of the .CSV files in the same folder?
 
Upvote 0
If they're all CSV files and all in one folder, you should use Power Query - it's made for that!
I highly recommend watching this video:
There's a link to a web page where you can download the files for that video. Search for PowerQuery04 on that page and download those files to follow along.
It's part of a college class on Power Query, and the playlist for the 197 videos are here: Power Query (Get & Transform) Video Playlist of Videos
That is a pretty long list, but he has similar ones that are a bit shorter like this one - Free Advanced Data Analysis & BI Course at YouTube (MSPTDA) that's only 83 videos.
The great thing about his videos is that not only is he really through and clear, but all his videos come with Start and Finished sample files. He's probably the best Excel Teacher on You Tube.
Power Query is REALLY the way to go!
 

Attachments

  • 1679233291779.png
    1679233291779.png
    112.6 KB · Views: 8
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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