#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Concatenate

Please i need help. I am working on a large file.
I need my output to be place in another column.
The end result should look like this.
I know that i have to use the for loop and concatenate.
quantity#5150225label#5150225stlye#5dgl
quantity#6000225label#5150225stlye#5apl
until the end
Sample data
Quantity Label Stlye
5150225 5150225 5dgl
6000225 5150225 5apl
5150225 5150225 5dgl
5150225 5150225 5apl
5150225 5150225 5dgl

..
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Concatenate

No VBA is needed for that. Assuming data is A2:C2, put in
D2: ="quantity#" & A2 & "label1#" & B2 & "stlye#" & C2

Copy to other rows as needed.

Hth,
Merjet

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Concatenate

You might try this:

="Quantity#" & A2 & "Label#" & B2 & "Style#" & C2

Then copy it down.

Mike

"maju" wrote:

Please i need help. I am working on a large file.
I need my output to be place in another column.
The end result should look like this.
I know that i have to use the for loop and concatenate.
quantity#5150225label#5150225stlye#5dgl
quantity#6000225label#5150225stlye#5apl
until the end
Sample data
Quantity Label Stlye
5150225 5150225 5dgl
6000225 5150225 5apl
5150225 5150225 5dgl
5150225 5150225 5apl
5150225 5150225 5dgl

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Concatenate

Formula like:

=($A$1&"#"&A2&$B$1&"#"&B2&$C$1&"#"&C2) ???

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Concatenate

Try this:
Sub CreateData()
Dim x As Double
Dim dataarray(50000, 3) As Variant
Let x = 1
Do While True
If Cells(x, 1).Value = Empty Then Exit Do
fnd = fnd + 1
dataarray(fnd, 1) = Cells(x, 1).Value
dataarray(fnd, 2) = Cells(x, 2).Value
dataarray(fnd, 3) = Cells(x, 3).Value
x = x + 1
Loop
If fnd 0 Then
Sheets("sheet2").Select
For x = 1 To fnd
Sheet2.Cells(x, 1).Value = "quantity#" & dataarray(x, 1) & "label#"
& dataarray(x, 2) & "style#" & dataarray(x, 3)
Next
End If




End Sub


"maju" wrote:

Please i need help. I am working on a large file.
I need my output to be place in another column.
The end result should look like this.
I know that i have to use the for loop and concatenate.
quantity#5150225label#5150225stlye#5dgl
quantity#6000225label#5150225stlye#5apl
until the end
Sample data
Quantity Label Stlye
5150225 5150225 5dgl
6000225 5150225 5apl
5150225 5150225 5dgl
5150225 5150225 5apl
5150225 5150225 5dgl

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Concatenate

Thx but i will be dealing with a huge number of rows. so i will not be able
to do it for each row. that is why i thought that looping will be better.

"merjet" wrote:

No VBA is needed for that. Assuming data is A2:C2, put in
D2: ="quantity#" & A2 & "label1#" & B2 & "stlye#" & C2

Copy to other rows as needed.

Hth,
Merjet


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Concatenate

Thx. i will try it and see if it works.

"Mike H." wrote:

Try this:
Sub CreateData()
Dim x As Double
Dim dataarray(50000, 3) As Variant
Let x = 1
Do While True
If Cells(x, 1).Value = Empty Then Exit Do
fnd = fnd + 1
dataarray(fnd, 1) = Cells(x, 1).Value
dataarray(fnd, 2) = Cells(x, 2).Value
dataarray(fnd, 3) = Cells(x, 3).Value
x = x + 1
Loop
If fnd 0 Then
Sheets("sheet2").Select
For x = 1 To fnd
Sheet2.Cells(x, 1).Value = "quantity#" & dataarray(x, 1) & "label#"
& dataarray(x, 2) & "style#" & dataarray(x, 3)
Next
End If




End Sub


"maju" wrote:

Please i need help. I am working on a large file.
I need my output to be place in another column.
The end result should look like this.
I know that i have to use the for loop and concatenate.
quantity#5150225label#5150225stlye#5dgl
quantity#6000225label#5150225stlye#5apl
until the end
Sample data
Quantity Label Stlye
5150225 5150225 5dgl
6000225 5150225 5apl
5150225 5150225 5dgl
5150225 5150225 5apl
5150225 5150225 5dgl

.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Concatenate


Mr.Mike
if the data in the excel is like:

quantity#5150225label#5150225stlye#5dgl
quantity#6000225label#5150225stlye#5apl

please let us know the VBA code to get data in the following format,

Quantity Label Stlye
5150225 5150225 5dgl
6000225 5150225 5apl
5150225 5150225 5dgl
5150225 5150225 5apl
5150225 5150225 5dgl

thanks in advance and with regards

ramesh

*** Sent via Developersdex http://www.developersdex.com ***
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Concatenate

ramesh,

Without VBA your string could be split using the menu Data | Text to
Columns and # as the delimiter, then deleting the words. If you want
the VBA code, split it with the macro recorder on.

Hth,
Merjet

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Concatenate

tried it. did not work.

"Mike H." wrote:

Try this:
Sub CreateData()
Dim x As Double
Dim dataarray(50000, 3) As Variant
Let x = 1
Do While True
If Cells(x, 1).Value = Empty Then Exit Do
fnd = fnd + 1
dataarray(fnd, 1) = Cells(x, 1).Value
dataarray(fnd, 2) = Cells(x, 2).Value
dataarray(fnd, 3) = Cells(x, 3).Value
x = x + 1
Loop
If fnd 0 Then
Sheets("sheet2").Select
For x = 1 To fnd
Sheet2.Cells(x, 1).Value = "quantity#" & dataarray(x, 1) & "label#"
& dataarray(x, 2) & "style#" & dataarray(x, 3)
Next
End If




End Sub


"maju" wrote:

Please i need help. I am working on a large file.
I need my output to be place in another column.
The end result should look like this.
I know that i have to use the for loop and concatenate.
quantity#5150225label#5150225stlye#5dgl
quantity#6000225label#5150225stlye#5apl
until the end
Sample data
Quantity Label Stlye
5150225 5150225 5dgl
6000225 5150225 5apl
5150225 5150225 5dgl
5150225 5150225 5apl
5150225 5150225 5dgl

.



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Concatenate

This works but i need it to stop at the last cell with data

Sub combine_columns()
Dim town As Variant
Dim site As Variant
Range("L:L").Select
For Each site In Range("A:A").SpecialCells(xlCellTypeConstants, 2)
For Each town In Range("J:J").SpecialCells(xlCellTypeConstants, 2)
ActiveCell.FormulaR1C1 = "=CONCATENATE(""po#"", RC[-11], ""st#"",
RC[-2])"
ActiveCell.Offset(1, 0).Select
Next
Next
End Sub


"Mike H." wrote:

Try this:
Sub CreateData()
Dim x As Double
Dim dataarray(50000, 3) As Variant
Let x = 1
Do While True
If Cells(x, 1).Value = Empty Then Exit Do
fnd = fnd + 1
dataarray(fnd, 1) = Cells(x, 1).Value
dataarray(fnd, 2) = Cells(x, 2).Value
dataarray(fnd, 3) = Cells(x, 3).Value
x = x + 1
Loop
If fnd 0 Then
Sheets("sheet2").Select
For x = 1 To fnd
Sheet2.Cells(x, 1).Value = "quantity#" & dataarray(x, 1) & "label#"
& dataarray(x, 2) & "style#" & dataarray(x, 3)
Next
End If




End Sub


"maju" wrote:

Please i need help. I am working on a large file.
I need my output to be place in another column.
The end result should look like this.
I know that i have to use the for loop and concatenate.
quantity#5150225label#5150225stlye#5dgl
quantity#6000225label#5150225stlye#5apl
until the end
Sample data
Quantity Label Stlye
5150225 5150225 5dgl
6000225 5150225 5apl
5150225 5150225 5dgl
5150225 5150225 5apl
5150225 5150225 5dgl

.

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Concatenate


Thanks for information
ramesh

*** Sent via Developersdex http://www.developersdex.com ***
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
Concatenate If Novice Excel Worksheet Functions 4 July 9th 09 10:05 PM
Concatenate help Gary S Excel Discussion (Misc queries) 3 November 27th 07 07:54 PM
Concatenate Morrigan Excel Discussion (Misc queries) 5 May 24th 06 11:04 PM
IF, IF, Concatenate? savvysam Excel Worksheet Functions 6 August 3rd 05 11:16 PM
I know how to concatenate ,can one de-concatenate to split date? QUICK BOOKS PROBLEM- New Users to Excel 1 July 26th 05 05:07 PM


All times are GMT +1. The time now is 10:04 AM.

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"