ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to cross-multiply text data in excel?? (https://www.excelbanter.com/excel-discussion-misc-queries/199804-how-cross-multiply-text-data-excel.html)

sang

How to cross-multiply text data in excel??
 
I need to cross-multiply following dat:

COLUMNS:
A........................B

ABC...................PQR
BBC...................LMN
KBC...................KKP

The result should be:

COLUMNS:
A........................B

ABC...................PQR
ABC...................LMN
ABC...................KKP
BBC...................PQR
BBC...................LMN
BBC...................KKP
KBC...................PQR
KBC...................LMN
KBC...................KKP

plz help

Mike H

How to cross-multiply text data in excel??
 
Hi,

Right click your sheet tab, view code and paste this in and run it.

Sub swapem()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A1:A" & lastrow).Copy
Range("A" & 65536 - lastrow).PasteSpecial
Range("B1:B" & lastrow).Copy
Range("A1").PasteSpecial
Range("A" & 65536 - lastrow & ":A65536").Copy
Range("B1").PasteSpecial
Range("A" & 65536 - lastrow & ":A65536").ClearContents
End Sub

Mike

"sang" wrote:

I need to cross-multiply following dat:

COLUMNS:
A........................B

ABC...................PQR
BBC...................LMN
KBC...................KKP

The result should be:

COLUMNS:
A........................B

ABC...................PQR
ABC...................LMN
ABC...................KKP
BBC...................PQR
BBC...................LMN
BBC...................KKP
KBC...................PQR
KBC...................LMN
KBC...................KKP

plz help


Herbert Seidenberg

How to cross-multiply text data in excel??
 
Use Pivot Table.
No code, no formulas.
Example at:
http://www.savefile.com/files/1745820



All times are GMT +1. The time now is 02:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com