PC Review


Reply
Thread Tools Rate Thread

Combine data in two columns into one and sort the combined column alphabetically..how??

 
 
Tommy
Guest
Posts: n/a
 
      9th Aug 2007
I have two columns, A and B. Each column contains a list of data in
text format e.g. 01TI518A.PV . It is possible that duplicates of this
text may appear within either column. Also, the number of data values
in each column is variable as they are imported from an external
source into the worksheet. I would like to be able to combine the text
from both columns into a single list in a single column, say column C.
I would also like this column to be alphanumerically sorted. How do I
go about doing this?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      9th Aug 2007
Sub mergecolumns()

LastrowA = Cells(Rows.Count, "A").End(xlUp).Row
LastrowB = Cells(Rows.Count, "B").End(xlUp).Row

If LastrowA > LastrowB Then
LastRow = LastrowA
Else
LastRow = LastrowB
End If

Set SourceRange = Range(Cells(1, "A"), Cells(LastRow, "B"))

RowCount = 1
For Each cell In SourceRange

If Not IsEmpty(cell.Value) Then

If RowCount = 1 Then
Cells(1, "D") = cell.Value
RowCount = RowCount + 1
Else
Set DestRange = Range(Cells(1, "D"), _
Cells(RowCount - 1, "D"))
Set c = DestRange.Find(what:=cell, LookIn:=xlValues)

If c Is Nothing Then
Cells(RowCount, "D") = cell.Value
RowCount = RowCount + 1
End If
End If



End If

Next cell

Range(Cells(1, "D"), Cells(RowCount - 1, "D")).Sort _
Key1:=Range("D1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub


"Tommy" wrote:

> I have two columns, A and B. Each column contains a list of data in
> text format e.g. 01TI518A.PV . It is possible that duplicates of this
> text may appear within either column. Also, the number of data values
> in each column is variable as they are imported from an external
> source into the worksheet. I would like to be able to combine the text
> from both columns into a single list in a single column, say column C.
> I would also like this column to be alphanumerically sorted. How do I
> go about doing this?
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      9th Aug 2007
Check your other posts, too.

Tommy wrote:
>
> I have two columns, A and B. Each column contains a list of data in
> text format e.g. 01TI518A.PV . It is possible that duplicates of this
> text may appear within either column. Also, the number of data values
> in each column is variable as they are imported from an external
> source into the worksheet. I would like to be able to combine the text
> from both columns into a single list in a single column, say column C.
> I would also like this column to be alphanumerically sorted. How do I
> go about doing this?


--

Dave Peterson
 
Reply With Quote
 
Dallman Ross
Guest
Posts: n/a
 
      10th Aug 2007
In <(E-Mail Removed)>, Dave Peterson
<(E-Mail Removed)> spake thusly:

> Check your other posts, too.


IOW: "It is possible that duplicates of this text may appear
in" other posts.

:-)

> Tommy wrote:
>
> > I have two columns, A and B. Each column contains a list of
> > data in text format e.g. 01TI518A.PV . It is possible that
> > duplicates of this text may appear within either column. Also,
> > the number of data values in each column is variable as they
> > are imported from an external source into the worksheet. I
> > would like to be able to combine the text from both columns
> > into a single list in a single column, say column C. I would
> > also like this column to be alphanumerically sorted. How do I
> > go about doing this?


=dman=

 
Reply With Quote
 
Tommy
Guest
Posts: n/a
 
      13th Aug 2007
On 10 Aug, 01:39, Dallman Ross <dman@localhost.> wrote:
> In <46BB05DF.FC573...@verizonXSPAM.net>, Dave Peterson
> <peter...@verizonxspam.net> spake thusly:
>
> > Check your other posts, too.

>
> IOW: "It is possible that duplicates of this text may appear
> in" other posts.
>
> :-)
>
> > Tommy wrote:

>
> > > I have two columns, A and B. Each column contains a list of
> > > data in text format e.g. 01TI518A.PV . It is possible that
> > > duplicates of this text may appear within either column. Also,
> > > the number of data values in each column is variable as they
> > > are imported from an external source into the worksheet. I
> > > would like to be able to combine the text from both columns
> > > into a single list in a single column, say column C. I would
> > > also like this column to be alphanumerically sorted. How do I
> > > go about doing this?

>
> =dman=


many thanks for your help. i post so that i get an answer, spreading
my chances as it were. well done for pointing that out in your
pointless post.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine data in two columns into one and sort the combined column alphabetically..how?? Tommy Microsoft Excel Misc 4 9th Aug 2007 01:40 PM
Combine data in two columns into one and sort the combined column alphabetically..how?? Tommy Microsoft Excel Discussion 1 9th Aug 2007 12:33 PM
How to combine data from two columns into one column? dcnguyen Microsoft Excel Worksheet Functions 3 8th Jan 2006 11:40 PM
How do I combine tabulated data into a single column and list alphabetically? Kev Nurse Microsoft Excel Misc 1 4th Feb 2005 01:55 AM
How to combine data from two columns into one column =?Utf-8?B?cmVuYQ==?= Microsoft Excel Worksheet Functions 2 26th Oct 2004 04:37 AM


Features
 

Advertising
 

Newsgroups
 


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