Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Auto remove several text line

0

Hello, i want to ask what is the function that can automatically exclude or remove any text that starts with "0" from a list?

I have attached an excel file and as you see in the Raw Data column there are some rows that contains "0 WP" as the first 2 words in the sentence. I only need WPs that are greater than 0 to put into body email which looks like in the Trimmed Data column so i want to know how to filter out sentences start with 0 WP automatically

I am waiting you reply and thanks in advance

Answer
Discuss

Answers

0
Selected Answer

Fida

See the attached file in which I've set the autofilter on column B to a customer  text filter  with  "does not begin with" and a text value of "0 WP". Only the other rows are now displayed. (Note that I also removed the Trimmed data column, since the autofilter would hide some rows from yout Trimmed data). You'll also see a couple of screengraps (with red outline) to show the filter selections.

You can copy the cells from there but if you want to delete those rows, set the text filter to "begins with" instead, select the entire "0 WP" rows and delete them.

Office 365 users can use the FILTER (array) function in a single cell (and it will spill over into others). In the example below, I've used SEARCH to find the string you want to exclude. If that's at the start of a cell, the return value will be 1 (but it could be another number, 2 for "40 WP..." say) or an error. The test of that =1 will return TRUE so I've used the NOT function to invert that which will exclude those cells beginning with "0 WP"  from the filtered values:

=FILTER(Table1[Raw data],NOT(IFERROR((SEARCH("0 WP",Table1[Raw data])=1),FALSE)))

Hope this helps.

Discuss

Discussion

Thank you John, the function is helpful. I wanna ask 1 more thing, is it also possible to use the =Filter function? if so, how the function be like?
Fida_mutia (rep: 28) Aug 19, '21 at 1:41 am
Fida

See revised answer
John_Ru (rep: 6142) Aug 19, '21 at 2:50 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login