Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
uma
 
Posts: n/a
Default Concatenate two columns?


Hi,
I am new to this forum. I have a doubt about concatenation. I have two
colums with different keywords. i have to make all the combinations by
using those words. For an example, i have the following words in the
column A.

Alabama
alaska
arizona
texas
washington

and in Column B I have the following words

hotel
theatre

i want to combine both the columns. i want the output like this.

alabama hotel
alaska hotel
arizona hotel
texas hotel
washington hotel
alabama theatre
alaska theatre
arizona theatre
texas theatre
washington theatre

What function i have to use for this? please tell me procedures. i
can't do anything manually. i have used the concatenation function
already. but i can't use that for my words. because i have 40 words in
column A and 15 words in column B. So, please tell me the possibilities
and procedures.

Thanks


--
uma
------------------------------------------------------------------------
uma's Profile: http://www.excelforum.com/member.php...o&userid=33632
View this thread: http://www.excelforum.com/showthread...hreadid=534045

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Toppers
 
Posts: n/a
Default Concatenate two columns?

This will concatenate columns A & B and put the result in column C. It
assumes data strats in row 2.

If you are not familiar with VBA code/macros:

Press Alt+F11 which will display the VBE(Visual Basic Editor). In the
Project window, right click on the VBAProject (....) and then do
INSERT==Module. Copy/paste the code below.
To run, place the cursor in the code and click the RUN Macro (Greren
arrowhead) button.

HTH

Sub ab()
Dim rnga As Range, rngb As Range
Dim cella As Range, celb As Range
Dim r As Long
With Worksheets("Sheet1") '<== change "Sheet1" to your sheet if required
r = 2
Set rnga = .Range("A2:A" & .Cells(Rows.Count, "A").End(xlUp).Row)
Set rngb = .Range("B2:B" & .Cells(Rows.Count, "B").End(xlUp).Row)
For Each cellb In rngb
For Each cella In rnga
Cells(r, "C") = cella & " " & cellb
r = r + 1
Next cella
Next cellb
End With
End Sub

"uma" wrote:


Hi,
I am new to this forum. I have a doubt about concatenation. I have two
colums with different keywords. i have to make all the combinations by
using those words. For an example, i have the following words in the
column A.

Alabama
alaska
arizona
texas
washington

and in Column B I have the following words

hotel
theatre

i want to combine both the columns. i want the output like this.

alabama hotel
alaska hotel
arizona hotel
texas hotel
washington hotel
alabama theatre
alaska theatre
arizona theatre
texas theatre
washington theatre

What function i have to use for this? please tell me procedures. i
can't do anything manually. i have used the concatenation function
already. but i can't use that for my words. because i have 40 words in
column A and 15 words in column B. So, please tell me the possibilities
and procedures.

Thanks


--
uma
------------------------------------------------------------------------
uma's Profile: http://www.excelforum.com/member.php...o&userid=33632
View this thread: http://www.excelforum.com/showthread...hreadid=534045


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
Help with grouping columns couriced New Users to Excel 5 September 2nd 05 05:07 PM
How do I concatenate two columns when one is in date format? LauraL Excel Discussion (Misc queries) 3 August 29th 05 04:07 PM
Removing Near-Duplicate Rows, Leaving Those w/Most Data in Specific Columns foofoo Excel Discussion (Misc queries) 1 April 2nd 05 12:02 AM
Help with a formula for concatenate and search/find with 3 columns Mel Excel Worksheet Functions 4 March 7th 05 09:12 PM
Counting the Contents of Two Columns Molochi Excel Discussion (Misc queries) 6 December 22nd 04 08:13 PM


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