ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sorting (https://www.excelbanter.com/excel-discussion-misc-queries/83682-re-sorting.html)

harvindersingh1

Sorting
 

I have certain data in a column A(say). Now, in column A there are
certain entries that are repeating.I want that the entries that are
repeating two times should be displayed in column B, the items that are
repeating three times are displayed in column C and so on.

Kindly help....

With regards
Harvinder Singh


--
harvindersingh1
------------------------------------------------------------------------
harvindersingh1's Profile: http://www.excelforum.com/member.php...o&userid=31725
View this thread: http://www.excelforum.com/showthread...hreadid=533627


mrice

Sorting
 

The following macro should do this for you. I'm assuming that all the
data is in column A and the rest of the sheet is empty

Sub Reformat()
LastRow = Cells(65536, 1).End(xlUp).Row
For N = LastRow To 1 Step -1
If Application.CountIf(Range(Cells(1, 2), Cells(LastRow, 256)),
Cells(N, 1)) 0 Then
Cells(N, 1).Delete shift:=xlUp
Else
ItemCount = Application.CountIf(Columns(1), Cells(N, 1))
If ItemCount 1 Then
If Cells(1, ItemCount) = "" Then
Cells(1, ItemCount) = Cells(N, 1)
Else
Cells(65536, ItemCount).End(xlUp).Offset(1, 0) =
Cells(N, 1)
End If
Cells(N, 1).Delete shift:=xlUp
End If
End If
Next N
End Sub


--
mrice


------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=533627



All times are GMT +1. The time now is 02:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com