Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default look up and append result to row for multiple identical entries


Hi!
I hope my subject line was somewhat descriptive.

I have the following problem:
1. Column A of my extremely huge spreadsheet contains id numbers.
2. ID numbers appear more than once, because the same case is sprea
across multiple rows (i didn't set this thing up...)
3. I need each unique case to be in one single row.

Basically, I need to convert ...

A B C D
id1 1 2 1
id1 3 4 5
id2 2 1 5
id2 9 2 3

...to

A B C D E F G
id1 1 2 1 3 4 5
id2 2 1 5 9 2 3

Added difficulty:
The number of rows over which one unique case spreads is not constant
E.g., I have 10 id1, 20 id2, 15 id3...


Can anyone help? I'd be forever grateful!

a

--
as_sas
-----------------------------------------------------------------------
as_sass's Profile: http://www.excelforum.com/member.php...nfo&userid=906
View this thread: http://www.excelforum.com/showthread.php?threadid=39995

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default look up and append result to row for multiple identical entries

How about this?

Sub Macro1()
Range("A1").CurrentRegion.Select
Selection.Sort Key1:=Range("A1")
lrow = Selection.Rows.Count

For i = lrow To 2 Step -1
If Range("A" & i) < Range("A" & i - 1) Then GoTo donothing
lcol = Range("A" & i, Range("A" & i).End(xlToRight)).Columns.Count
Range(Cells(i, 2), Cells(i, lcol)).Copy
lcol = Range("A" & i - 1, Range("A" & i - 1).End(xlToRight)).Columns.Count
Cells(i - 1, lcol + 1).Select
ActiveSheet.Paste
Range("A" & i).EntireRow.Delete
donothing:
Next i

End Sub


"as_sass" wrote:


Hi!
I hope my subject line was somewhat descriptive.

I have the following problem:
1. Column A of my extremely huge spreadsheet contains id numbers.
2. ID numbers appear more than once, because the same case is spread
across multiple rows (i didn't set this thing up...)
3. I need each unique case to be in one single row.

Basically, I need to convert ...

A B C D
id1 1 2 1
id1 3 4 5
id2 2 1 5
id2 9 2 3

...to

A B C D E F G
id1 1 2 1 3 4 5
id2 2 1 5 9 2 3

Added difficulty:
The number of rows over which one unique case spreads is not constant.
E.g., I have 10 id1, 20 id2, 15 id3...


Can anyone help? I'd be forever grateful!

as


--
as_sass
------------------------------------------------------------------------
as_sass's Profile: http://www.excelforum.com/member.php...fo&userid=9065
View this thread: http://www.excelforum.com/showthread...hreadid=399950


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default look up and append result to row for multiple identical entries


Works like a charm!
Can I send you flowers?!?

as

PS: actually, just ran into a problem:
I have several ID numbers that appear more than 250 times.
That means I'll run into the problem that the worksheet is not "long
enough.

Apart from "use a database and not Excel", does anybody know a solutio
to this problem? Like writing the whole thing as one row to a text file
for example?

Thanks!

a

--
as_sas
-----------------------------------------------------------------------
as_sass's Profile: http://www.excelforum.com/member.php...nfo&userid=906
View this thread: http://www.excelforum.com/showthread.php?threadid=39995

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
Deleting Identical Entries SV Excel Worksheet Functions 2 December 12th 06 12:45 AM
How to lookup when range contains multiple identical entries? Doug Laidlaw Excel Discussion (Misc queries) 1 January 19th 06 12:18 PM
Two identical formulas for a different result? hochedez Excel Discussion (Misc queries) 5 September 9th 05 03:43 AM
Two identical entries in "Window" list John Keith Excel Discussion (Misc queries) 5 February 17th 05 02:45 AM
Inexplicable difference in row hiding speed - identical code, identical machines! Matt Larkin Excel Programming 5 November 1st 04 10:35 AM


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