Grouping rows in Excel

Bren.ie

New Member
Joined
Aug 29, 2002
Messages
7
I have data imported into Excel. The data is arranged with a row detailing a product heading, followed immediatly by rows with product data, followed by a blank row separating the data from the next next product header, rows of data etc.

I there way I can segregate, for example all products ending with the letter S together with the data rows for that product, and delete all others.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You copy this code into a VBA module and run to delete the blank rows.

Sub Data_Segregate()
Dim I
For I = 1 To 65536
If Range("A" & I) = "" Then ActiveCell.Cells.EntireRow.Delete
Next I

End Sub

You can change the Max value of I to match with your last row number containing data.

Write the following formula

For Ex. Product named "Bolts" in A1 and a number 500 in A2 is there in your worksheet
Then in B1 write the formula
=If(Right(Trim(A1),1)="S",A1)
in B2
=If(Right(Trim(A1),1)="S",A2)

GNaga
 
Upvote 0

Forum statistics

Threads
1,219,006
Messages
6,145,708
Members
450,635
Latest member
Rookie3510

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