Delete Rows Matching Data Criteria

SOLTEC

Board Regular
Joined
Feb 11, 2015
Messages
195
Office Version
  1. 365
  2. 2019
Platform
  1. Windows

Excel 2010
DEFGH
1Supplier IDReference No.WholesaleQuantity
210-011001Replacement Boot Laces
310-01210012Replacement Boot Laces
410-50 OD1050Blousing Garters
510-50210502Blousing Garters
610-50510505Blousing Garters
710-50710507Blousing Garters
810-89 04 W1089GI Extreme Cold Weather Bunny Boots
910-89 05 W1089GI Extreme Cold Weather Bunny Boots
1010-89 08 R1089GI Extreme Cold Weather Bunny Boots
1110-89 11 W1089GI Extreme Cold Weather Bunny Boots
1210-89 14 R1089GI Extreme Cold Weather Bunny Boots
1310-89 14 W1089GI Extreme Cold Weather Bunny Boots
1411-101110Nylon Commando Wallet
1511-111111Nylon Commando Wallet
1611-141114Nylon Commando Wallet
1711-14311143Nylon Commando Wallet
1811-14711147Nylon Commando Wallet
1911-151115Nylon Commando Wallet
2011-161116Nylon Commando Wallet
2112-011201Pepper Sprays Gel Sabre Red
2212-01F1201F1Fire Master Fog Pepper Spray
2312-021202Pepper Sprays Gel Sabre Red
2412-02512025Pepper Sprays Gel Sabre Red
2512-02712027Pepper Sprays Gel Sabre Red
2612-02812028Pepper Sprays Gel Sabre Red
2712-02F1202F1Key Chain Pepper Spray
2812-031203Pepper Sprays Gel Sabre Red
2912-031F12031FCop Top Fog Cone Pepper Spray
3012-032F12032FFlip Top Stream Pepper Spray
3112-033F12033FFlip Top Cop Med Fog Cone Pepper Spray
3212-03512035Pepper Sprays Gel Sabre Red
3312-03F1203FCop Top Stream Pepper Spray
3412-041204Pepper Sprays Gel Sabre Red
3512-041F12041FCop Top Fog Cone Pepper Spray
3612-042F12042FFlip Top Stream Pepper Spray
3712-043F12043FFlip Top Cop Med Fog Cone Pepper Spray
3812-04F1204FCop Top Stream Pepper Spray
3912-051205Pepper Sprays Gel Sabre Red
4012-05512055Pepper Sprays Gel Sabre Red
4112-0612061Police Magnum Sabre Red
Fox Combinations
Cell Formulas
RangeFormula
D1Supplier ID
D210-01
D310-012
D410-50 OD
D510-502
D610-505
D710-507
D810-89 04 W
D910-89 05 W
D1010-89 08 R
D1110-89 11 W
D1210-89 14 R
D1310-89 14 W
D1411-10
D1511-11
D1611-14
D1711-143
D1811-147
D1911-15
D2011-16
D2112-01
D2212-01F
D2312-02
D2412-025
D2512-027
D2612-028
D2712-02F
D2812-03
D2912-031F
D3012-032F
D3112-033F
D3212-035
D3312-03F
D3412-04
D3512-041F
D3612-042F
D3712-043F
D3812-04F
D3912-05
D4012-055
D4112-06
E1Reference No.
E21001
E310012
E41050
E510502
E610505
E710507
E81089
E91089
E101089
E111089
E121089
E131089
E141110
E151111
E161114
E1711143
E1811147
E191115
E201116
E211201
E221201F
E231202
E2412025
E2512027
E2612028
E271202F
E281203
E2912031F
E3012032F
E3112033F
E3212035
E331203F
E341204
E3512041F
E3612042F
E3712043F
E381204F
E391205
E4012055
E411206
F1Wholesale
H1Quantity
H2Replacement Boot Laces
H3Replacement Boot Laces
H4Blousing Garters
H5Blousing Garters
H6Blousing Garters
H7Blousing Garters
H8GI Extreme Cold Weather Bunny Boots
H9GI Extreme Cold Weather Bunny Boots
H10GI Extreme Cold Weather Bunny Boots
H11GI Extreme Cold Weather Bunny Boots
H12GI Extreme Cold Weather Bunny Boots
H13GI Extreme Cold Weather Bunny Boots
H14Nylon Commando Wallet
H15Nylon Commando Wallet
H16Nylon Commando Wallet
H17Nylon Commando Wallet
H18Nylon Commando Wallet
H19Nylon Commando Wallet
H20Nylon Commando Wallet
H21Pepper Sprays Gel Sabre Red
H22Fire Master Fog Pepper Spray
H23Pepper Sprays Gel Sabre Red
H24Pepper Sprays Gel Sabre Red
H25Pepper Sprays Gel Sabre Red
H26Pepper Sprays Gel Sabre Red
H27Key Chain Pepper Spray
H28Pepper Sprays Gel Sabre Red
H29Cop Top Fog Cone Pepper Spray
H30Flip Top Stream Pepper Spray
H31Flip Top Cop Med Fog Cone Pepper Spray
H32Pepper Sprays Gel Sabre Red
H33Cop Top Stream Pepper Spray
H34Pepper Sprays Gel Sabre Red
H35Cop Top Fog Cone Pepper Spray
H36Flip Top Stream Pepper Spray
H37Flip Top Cop Med Fog Cone Pepper Spray
H38Cop Top Stream Pepper Spray
H39Pepper Sprays Gel Sabre Red
H40Pepper Sprays Gel Sabre Red
H41Police Magnum Sabre Red
G221
G271
G411


I need a formula or function to remove all the rows with (1) in them in column G. Thank you in advance for any and all assistance.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
SOLTEC,

Here is a macro solution for you to consider that does not use filtering, or, looping thru the data, but, removes the rows in column G that contain 1.

Sample raw data (not all rows are shown for brevity):


Excel 2007
DEFGH
1Supplier IDReference No.WholesaleQuantity
210-01 1001Replacement Boot Laces
310-012 10012Replacement Boot Laces
2011-16 1116Nylon Commando Wallet
2112-01 1201Pepper Sprays Gel Sabre Red
2212-01F 1201F1Fire Master Fog Pepper Spray
2312-02 1202Pepper Sprays Gel Sabre Red
2412-025 12025Pepper Sprays Gel Sabre Red
2512-027 12027Pepper Sprays Gel Sabre Red
2612-028 12028Pepper Sprays Gel Sabre Red
2712-02F 1202F1Key Chain Pepper Spray
2812-03 1203Pepper Sprays Gel Sabre Red
2912-031F 12031FCop Top Fog Cone Pepper Spray
3912-05 1205Pepper Sprays Gel Sabre Red
4012-055 12055Pepper Sprays Gel Sabre Red
4112-06 12061Police Magnum Sabre Red
42
Fox Combinations


After the macro:


Excel 2007
DEFGH
1Supplier IDReference No.WholesaleQuantity
210-01 1001Replacement Boot Laces
310-012 10012Replacement Boot Laces
2011-16 1116Nylon Commando Wallet
2112-01 1201Pepper Sprays Gel Sabre Red
2212-02 1202Pepper Sprays Gel Sabre Red
2312-025 12025Pepper Sprays Gel Sabre Red
2412-027 12027Pepper Sprays Gel Sabre Red
2512-028 12028Pepper Sprays Gel Sabre Red
2612-03 1203Pepper Sprays Gel Sabre Red
2712-031F 12031FCop Top Fog Cone Pepper Spray
3712-05 1205Pepper Sprays Gel Sabre Red
3812-055 12055Pepper Sprays Gel Sabre Red
39
40
41
42
Fox Combinations


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

1. Copy the below code
2. Open your NEW workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

Code:
Sub DeleteColumnG_rows_EqualTo1()
' hiker95, 03/11/2015, ME841686
With Sheets("Fox Combinations")
  On Error Resume Next
  With .Range("G2:G" & CStr(.Range("D" & Rows.Count).End(xlUp).Row))
    .Replace "1", "#NAME?", xlWhole, xlByRows, False
    .SpecialCells(xlCellTypeConstants, xlErrors).EntireRow.Delete xlUp
  End With
End With
End Sub

Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm, and, answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.

Then run the DeleteColumnG_rows_EqualTo1 macro.
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,937
Members
449,196
Latest member
Maxkapoor

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