Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
KH KH is offline
external usenet poster
 
Posts: 2
Default Using formula to extract info

I have a few columns of info which I want to extract (more than a 1000 rows).
111 Data1
112 Data2
112 Data3
113 Data4
113 Data5
114 Data6
114 Data7
114 Data8
How can I extract such that for the same value in the first column, the data
in column 2 is copy to the same row as the first value.
e.g
111 Data1
112 Data2 Data3
113 Data4 Data5
114 Data6 Data7 Data8


--
KH
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Using formula to extract info

KH,

Since this is a programming newsgroup, try the macro below.

Assumes your table is in columns A and B starting in row 1, with labels in
row 1, and that there is nothing else on the sheet.

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim myCell As Range
Dim mySource As Range
Dim myTarget As Range
Dim myRow As Variant

Set mySource = Intersect(Range("A2:A65536"), ActiveSheet.UsedRange)
Range("D1") = Range("A1").Value

For Each myCell In mySource
myRow = Application.Match(myCell.Value, Range("D:D"), False)
If Not (IsNumeric(myRow)) Then
Set myTarget = Range("D65536").End(xlUp)(2)
myTarget.Value = myCell.Value
myTarget(1, 2).Value = myCell(1, 2).Value
Else
Cells(myRow, 256).End(xlToLeft)(1, 2).Value = myCell(1, 2).Value
End If
Next myCell
End Sub


"KH" wrote in message
...
I have a few columns of info which I want to extract (more than a 1000

rows).
111 Data1
112 Data2
112 Data3
113 Data4
113 Data5
114 Data6
114 Data7
114 Data8
How can I extract such that for the same value in the first column, the

data
in column 2 is copy to the same row as the first value.
e.g
111 Data1
112 Data2 Data3
113 Data4 Data5
114 Data6 Data7 Data8


--
KH



  #3   Report Post  
Posted to microsoft.public.excel.programming
KH KH is offline
external usenet poster
 
Posts: 2
Default Using formula to extract info

Hi Bernie,
Tried your macro. It did not run as needed. The results was just the same as
the first two column of info.
I would like for the same value in column one cells, the second column data
be appended to the next column.
i.e.
1113 Data4 Data5
1114 Data6 Data7 Data8

Any possibility?

KH

"Bernie Deitrick" wrote:

KH,

Since this is a programming newsgroup, try the macro below.

Assumes your table is in columns A and B starting in row 1, with labels in
row 1, and that there is nothing else on the sheet.

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim myCell As Range
Dim mySource As Range
Dim myTarget As Range
Dim myRow As Variant

Set mySource = Intersect(Range("A2:A65536"), ActiveSheet.UsedRange)
Range("D1") = Range("A1").Value

For Each myCell In mySource
myRow = Application.Match(myCell.Value, Range("D:D"), False)
If Not (IsNumeric(myRow)) Then
Set myTarget = Range("D65536").End(xlUp)(2)
myTarget.Value = myCell.Value
myTarget(1, 2).Value = myCell(1, 2).Value
Else
Cells(myRow, 256).End(xlToLeft)(1, 2).Value = myCell(1, 2).Value
End If
Next myCell
End Sub


"KH" wrote in message
...
I have a few columns of info which I want to extract (more than a 1000

rows).
111 Data1
112 Data2
112 Data3
113 Data4
113 Data5
114 Data6
114 Data7
114 Data8
How can I extract such that for the same value in the first column, the

data
in column 2 is copy to the same row as the first value.
e.g
111 Data1
112 Data2 Data3
113 Data4 Data5
114 Data6 Data7 Data8


--
KH




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Using formula to extract info

KH,

I don't know what to say - I tested my macro on your data set, and got
precisely the output that you indicated in your post, so the code works
fine. If you send me an email, I will send you a working version - remove
the spaces and change the dot to a . in my email address.

HTH,
Bernie
MS Excel MVP

"KH" wrote in message
...
Hi Bernie,
Tried your macro. It did not run as needed. The results was just the same

as
the first two column of info.
I would like for the same value in column one cells, the second column

data
be appended to the next column.
i.e.
1113 Data4 Data5
1114 Data6 Data7 Data8

Any possibility?

KH

"Bernie Deitrick" wrote:

KH,

Since this is a programming newsgroup, try the macro below.

Assumes your table is in columns A and B starting in row 1, with labels

in
row 1, and that there is nothing else on the sheet.

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim myCell As Range
Dim mySource As Range
Dim myTarget As Range
Dim myRow As Variant

Set mySource = Intersect(Range("A2:A65536"), ActiveSheet.UsedRange)
Range("D1") = Range("A1").Value

For Each myCell In mySource
myRow = Application.Match(myCell.Value, Range("D:D"), False)
If Not (IsNumeric(myRow)) Then
Set myTarget = Range("D65536").End(xlUp)(2)
myTarget.Value = myCell.Value
myTarget(1, 2).Value = myCell(1, 2).Value
Else
Cells(myRow, 256).End(xlToLeft)(1, 2).Value = myCell(1, 2).Value
End If
Next myCell
End Sub


"KH" wrote in message
...
I have a few columns of info which I want to extract (more than a 1000

rows).
111 Data1
112 Data2
112 Data3
113 Data4
113 Data5
114 Data6
114 Data7
114 Data8
How can I extract such that for the same value in the first column,

the
data
in column 2 is copy to the same row as the first value.
e.g
111 Data1
112 Data2 Data3
113 Data4 Data5
114 Data6 Data7 Data8


--
KH






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
Extract info based on Name khers Excel Discussion (Misc queries) 4 July 25th 11 04:24 PM
Extract info from one sheet to another Kim Excel Worksheet Functions 2 March 15th 08 01:30 PM
Extract some info from a string mathew Excel Discussion (Misc queries) 2 October 11th 06 10:02 PM
Would it be possible to extract info from this site? IntricateFool Excel Discussion (Misc queries) 3 September 14th 06 05:55 PM
Please help: Extract some info. from a cell Bobsus5 Excel Worksheet Functions 1 March 7th 06 02:06 AM


All times are GMT +1. The time now is 09:28 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"