Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default when the column text is different, how to insert one row below eac

I have a spreadsheet with column, Date, Name, Amount. only a few columns, but
a few thousand rows with same Name, different Date and different Amount.
Sample below:
Date Name Amount
4/1/07 John 100
4/1/07 Michael 200
4/2/07 John 110
4/2/07 Michael 220
4/4/07 John 130
4/4/07 Michael 230
First I will sort the above by Name then by Date, then I insert one blank
row just below John.
When I have a hundred different Names, How to automatically insert one blank
row when the Name is different?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default when the column text is different, how to insert one row below eac

-First sort the above by Name then by Date
-Create a helper column in (column c)

In C2: =COUNTIF($B$3:B3,B3)=1
Copy all the way down
AutoFilter all the TRUE select all the filter rows using the row numbers
on the far left Edit Go To Special Select Visible cells only
OK Insert Rows Remove the AutoFilter and Delete the helper column


"Greensky Young" wrote:

I have a spreadsheet with column, Date, Name, Amount. only a few columns, but
a few thousand rows with same Name, different Date and different Amount.
Sample below:
Date Name Amount
4/1/07 John 100
4/1/07 Michael 200
4/2/07 John 110
4/2/07 Michael 220
4/4/07 John 130
4/4/07 Michael 230
First I will sort the above by Name then by Date, then I insert one blank
row just below John.
When I have a hundred different Names, How to automatically insert one blank
row when the Name is different?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default when the column text is different, how to insert one row below

Oops, Should be B2 instead of B3

In C2: =COUNTIF($B$2:B2,B2)=1

"Teethless mama" wrote:

-First sort the above by Name then by Date
-Create a helper column in (column c)

In C2: =COUNTIF($B$3:B3,B3)=1
Copy all the way down
AutoFilter all the TRUE select all the filter rows using the row numbers
on the far left Edit Go To Special Select Visible cells only
OK Insert Rows Remove the AutoFilter and Delete the helper column


"Greensky Young" wrote:

I have a spreadsheet with column, Date, Name, Amount. only a few columns, but
a few thousand rows with same Name, different Date and different Amount.
Sample below:
Date Name Amount
4/1/07 John 100
4/1/07 Michael 200
4/2/07 John 110
4/2/07 Michael 220
4/4/07 John 130
4/4/07 Michael 230
First I will sort the above by Name then by Date, then I insert one blank
row just below John.
When I have a hundred different Names, How to automatically insert one blank
row when the Name is different?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default when the column text is different, how to insert one row below eac

Sub InsertRow_At_Change()
Dim i As Long
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
For i = Cells(Rows.Count, 2).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 2) < Cells(i, 2) Then _
Cells(i, 2).Resize(1, 2).EntireRow.Insert
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub


Gord Dibben MS Excel MVP


On Mon, 23 Apr 2007 15:02:04 -0700, Greensky Young <Greensky
wrote:

I have a spreadsheet with column, Date, Name, Amount. only a few columns, but
a few thousand rows with same Name, different Date and different Amount.
Sample below:
Date Name Amount
4/1/07 John 100
4/1/07 Michael 200
4/2/07 John 110
4/2/07 Michael 220
4/4/07 John 130
4/4/07 Michael 230
First I will sort the above by Name then by Date, then I insert one blank
row just below John.
When I have a hundred different Names, How to automatically insert one blank
row when the Name is different?


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default when the column text is different, how to insert one row below

Thanks so much. It works. If the name, John only appears once. John will not
separate itself.

Thanks again.

"Teethless mama" wrote:

Oops, Should be B2 instead of B3

In C2: =COUNTIF($B$2:B2,B2)=1

"Teethless mama" wrote:

-First sort the above by Name then by Date
-Create a helper column in (column c)

In C2: =COUNTIF($B$3:B3,B3)=1
Copy all the way down
AutoFilter all the TRUE select all the filter rows using the row numbers
on the far left Edit Go To Special Select Visible cells only
OK Insert Rows Remove the AutoFilter and Delete the helper column


"Greensky Young" wrote:

I have a spreadsheet with column, Date, Name, Amount. only a few columns, but
a few thousand rows with same Name, different Date and different Amount.
Sample below:
Date Name Amount
4/1/07 John 100
4/1/07 Michael 200
4/2/07 John 110
4/2/07 Michael 220
4/4/07 John 130
4/4/07 Michael 230
First I will sort the above by Name then by Date, then I insert one blank
row just below John.
When I have a hundred different Names, How to automatically insert one blank
row when the Name is different?



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default when the column text is different, how to insert one row below

Thanks.
Please tell me how to use this "Sub" in my spreadsheet.
Is this a macro?
Thanks again.

"Gord Dibben" wrote:

Sub InsertRow_At_Change()
Dim i As Long
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
For i = Cells(Rows.Count, 2).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 2) < Cells(i, 2) Then _
Cells(i, 2).Resize(1, 2).EntireRow.Insert
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub


Gord Dibben MS Excel MVP


On Mon, 23 Apr 2007 15:02:04 -0700, Greensky Young <Greensky
wrote:

I have a spreadsheet with column, Date, Name, Amount. only a few columns, but
a few thousand rows with same Name, different Date and different Amount.
Sample below:
Date Name Amount
4/1/07 John 100
4/1/07 Michael 200
4/2/07 John 110
4/2/07 Michael 220
4/4/07 John 130
4/4/07 Michael 230
First I will sort the above by Name then by Date, then I insert one blank
row just below John.
When I have a hundred different Names, How to automatically insert one blank
row when the Name is different?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert cell text every 5 rows in a column Mike Mike Excel Discussion (Misc queries) 9 September 16th 10 09:53 AM
text box insert in Excel - text box lines print on second copy Diana (Berry & Co) Excel Discussion (Misc queries) 0 July 26th 06 04:39 AM
How to insert text in one column and populate numbers in another Alice Excel Worksheet Functions 0 March 28th 06 07:27 PM
how insert same text in empty cells in column (10000 rows) bromptongadgets Excel Worksheet Functions 1 December 11th 05 03:13 PM
Need a macro to insert text in a cell that already has text.Excel go1angel Excel Discussion (Misc queries) 2 October 5th 05 10:32 PM


All times are GMT +1. The time now is 05:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"