Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 184
Default Formula or script needed

I am trying to use a formula or script to take the data from Sheet two column
C to sheet one given certain criteria in sheet one column A and sheet two
columns A and B. Below are the two sheets along with what sheet one should
look like after. This is for a rather large range of data.

Thank you
Jeremy

Sheet one
A B
1 5657 0020
2 5657 0021
3 1345 0010
4 1345 0020
5 1342 0020


Sheet two
A B C
1 5657 0020 JDR1
2 5657 0020 JDR2
3 5657 0020 JDR3
4 5657 0021 JDR4
5 1345 0010 JDR5
6 1345 0020 JDR6
7 1342 0020 JDR7
8 1342 0020 JDR8
9 1342 0020 JDR9



What sheet one should look like on sheet one from data in sheet two columns C

A B
1 5657 0020 JDR1, JDR2, JDR3
2 5657 0021 JDR4
3 1345 0010 JDR5
4 1345 0020 JDR6
5 1342 0020 JDR7, JDR8, JDR9

Can look like and go to e and so on if more JDR numbers corresponding to A
in sheet one

A B C D E F
1 5657 0020 JDR1 JDR2 JDR3
2 5657 0021 JDR4
3 1345 0010 JDR5
4 1345 0020 JDR6
5 1342 0020 JDR7 JDR8 JDR9


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Formula or script needed

the code below expects two worksheets called "Sheet1" and "Sheet2". It
expects Sheet1 to be blank. It will create sheet1 based on the data in
sheet2.


Sub MakeSummary()

NewRow = 1
RowCount = 1
With Sheets("sheet2")
Do While .Range("A" & RowCount) < ""
CombineNumber = .Range("A" & RowCount).Text & _
" " & .Range("B" & RowCount).Text
JDRNumber = .Range("C" & RowCount)
With Sheets("Sheet1")
Set c = .Columns("A").Find(what:=CombineNumber, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
.Range("A" & NewRow) = CombineNumber
.Range("B" & NewRow) = JDRNumber
NewRow = NewRow + 1
Else
.Range("B" & c.Row) = .Range("B" & c.Row) & _
", " & JDRNumber
End If

End With
RowCount = RowCount + 1
Loop
End With
End Sub


"Jeremy" wrote:

I am trying to use a formula or script to take the data from Sheet two column
C to sheet one given certain criteria in sheet one column A and sheet two
columns A and B. Below are the two sheets along with what sheet one should
look like after. This is for a rather large range of data.

Thank you
Jeremy

Sheet one
A B
1 5657 0020
2 5657 0021
3 1345 0010
4 1345 0020
5 1342 0020


Sheet two
A B C
1 5657 0020 JDR1
2 5657 0020 JDR2
3 5657 0020 JDR3
4 5657 0021 JDR4
5 1345 0010 JDR5
6 1345 0020 JDR6
7 1342 0020 JDR7
8 1342 0020 JDR8
9 1342 0020 JDR9



What sheet one should look like on sheet one from data in sheet two columns C

A B
1 5657 0020 JDR1, JDR2, JDR3
2 5657 0021 JDR4
3 1345 0010 JDR5
4 1345 0020 JDR6
5 1342 0020 JDR7, JDR8, JDR9

Can look like and go to e and so on if more JDR numbers corresponding to A
in sheet one

A B C D E F
1 5657 0020 JDR1 JDR2 JDR3
2 5657 0021 JDR4
3 1345 0010 JDR5
4 1345 0020 JDR6
5 1342 0020 JDR7 JDR8 JDR9


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
VB Script Code needed for Grouping Rows Abhi_Rise Excel Discussion (Misc queries) 0 February 19th 08 02:01 PM
Formula Help needed Krish Excel Worksheet Functions 2 November 3rd 07 02:53 PM
Vlookup formula script Gor_yee Excel Discussion (Misc queries) 1 August 5th 07 03:27 PM
How can I script formula? Sam Excel Worksheet Functions 2 July 10th 06 06:22 AM
Help needed (Automatic script function) Soul Excel Discussion (Misc queries) 5 January 10th 06 03:48 PM


All times are GMT +1. The time now is 04:19 PM.

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

About Us

"It's about Microsoft Excel"