Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50139

VBA: Delete row containing text A but skip if contains text A & text B

$
0
0
I have a list of supplier names in column E. There are thousands of records. Some contain only TAXI, while others contain TAXI and LIMO. I want to delete rows containing only TAXI, but leave rows containing both TAXI and LIMO. Below is how I was previously doing this. I would use either of the two formulas below to mark the suppliers that only contained Taxi as "Taxi Only," then I would manually delete the rows. The things is, this is very slow as the logic formulas and row-deleting bog down Excel. So preferably I'd like to avoid using the formulas altogether.

=IF(AND(COUNTIF(E2,"*TAXI*")>0,COUNTIF(E2,"*LIMO*")>0),"TAXI & LIMO",IF(COUNTIF(E2,"*TAXI*")>0,"Taxi Only","NA"))

=IF(AND(ISNUMBER(SEARCH("TAXI",E2)),ISNUMBER(SEARCH("LIMO",E2))),"Taxi & Limo",IF(ISNUMBER(SEARCH("Taxi",E2)),"Taxi Only","NA"))

Viewing all articles
Browse latest Browse all 50139

Trending Articles