multiple ranges, transposing?

  • Thread starter Thread starter Mea
  • Start date Start date
M

Mea

I start with a list like this

company carries
101 INDUSTRIES BRASS
LIGHTING HOME NICKEL
FRANKFURT BRASS
FRANKFURT NICKEL
FRANKFURT STAINLESS
FRANKFURT COPPER
Jersey COPPER
Dallas NICKEL
Dallas STAINLESS
Dallas COPPER


I need to end up with a list like this
company carries
101 INDUSTRIES brass
LIGHTING HOME NICKEL
FRANKFURT BRASS NICKEL STAINLESS COPPER
Jersey COPPER
Dallas NICKEL STAINLESS COPPER


If it were just these few, I would insert some blanks and then transpose.
But my list is over 30,000 rows with a few thousand different companies. I'm
pretty new with this level of Excel and am about to bang my head with
frustration. Can someone help? Please!!
 
hi, !

are macros a valid alternate for this purpose ?... if so,

copy/paste the following into a standar code module in the vba editor
and run while "that" worksheets is the active sheet...

Sub Transpose_CarriesByVendor()
Application.ScreenUpdating = False
Dim Start As Long, nCols As Byte, nRow As Integer
With ActiveSheet
Worksheets.Add(After:=Worksheets(.Index)).Name = "Transposed"
.Range(.[a1], .[a65536].End(xlUp)).AdvancedFilter _
Action:=xlFilterCopy, CopyToRange:=[a1], Unique:=True
[a:a].Sort Key1:=[a2], Order1:=xlAscending, Header:=True
For nRow = 2 To [a65536].End(xlUp).Row
Start = Application.Match(Range("a" & nRow), .Range("a:a"), 0)
nCols = Application.CountIf(.Range("a:a"), Range("a" & nRow))
If nCols > 1 Then
Range("b" & nRow).Resize(, nCols).Value = _
Application.Transpose(.Range("b" & Start).Resize(nCols).Value)
Else: Range("b" & nRow) = .Range("b" & Start)
End If
Next
End With
End Sub

hth,
hector.

__ OP __
 
Hi! Sir

I try your code but it is not work

Thanks

hardeep

Héctor Miguel said:
hi, !

are macros a valid alternate for this purpose ?... if so,

copy/paste the following into a standar code module in the vba editor
and run while "that" worksheets is the active sheet...

Sub Transpose_CarriesByVendor()
Application.ScreenUpdating = False
Dim Start As Long, nCols As Byte, nRow As Integer
With ActiveSheet
Worksheets.Add(After:=Worksheets(.Index)).Name = "Transposed"
.Range(.[a1], .[a65536].End(xlUp)).AdvancedFilter _
Action:=xlFilterCopy, CopyToRange:=[a1], Unique:=True
[a:a].Sort Key1:=[a2], Order1:=xlAscending, Header:=True
For nRow = 2 To [a65536].End(xlUp).Row
Start = Application.Match(Range("a" & nRow), .Range("a:a"), 0)
nCols = Application.CountIf(.Range("a:a"), Range("a" & nRow))
If nCols > 1 Then
Range("b" & nRow).Resize(, nCols).Value = _
Application.Transpose(.Range("b" & Start).Resize(nCols).Value)
Else: Range("b" & nRow) = .Range("b" & Start)
End If
Next
End With
End Sub

hth,
hector.

__ OP __
I start with a list like this

company carries
101 INDUSTRIES BRASS
LIGHTING HOME NICKEL
FRANKFURT BRASS
FRANKFURT NICKEL
FRANKFURT STAINLESS
FRANKFURT COPPER
Jersey COPPER
Dallas NICKEL
Dallas STAINLESS
Dallas COPPER

I need to end up with a list like this
company carries
101 INDUSTRIES brass
LIGHTING HOME NICKEL
FRANKFURT BRASS NICKEL STAINLESS COPPER
Jersey COPPER
Dallas NICKEL STAINLESS COPPER

If it were just these few, I would insert some blanks and then transpose.
But my list is over 30,000 rows with a few thousand different companies.
I'm pretty new with this level of Excel and am about to bang my head with frustration.
Can someone help? Please!!
 
its Grt
Most ot the Most Appriciate

Could you Please tell How do you do that bcoz i am not expert in excel

Thanks In Advanc

(e-mail address removed)
 
On Nov 3, 6:57 pm, Hardeep_kanwar
.... what is BinA,BinB,Loc,Rept

These are the defined names for the helper rows/columns.
Find them in the Name Manager.
 
Sorry to disturb you again
Could you Please tell me why some headers have two Define Name i.e.
Children+childrenname,Child_DOB+DOB,Propno+propnu,Prop_DOB+PropDOB.
Is there any reason to Define Name these Columns twice with some changes.

If i have to Make these type of report in another or different headers which
Columns would i Define name twice.

Thanks In Advance

Hardeep Kanwar
 
Review naming rules in Help.
Some of the names I edited, shortened, or numbered
still appeared in the Name Manager.
Twice defined ranges cause no errors, but I cleaned them up.
To avoid confusion, PropNu has been changed to Key.
Notice that most defined names are on Master sheet.
The new names I added are only on Slave sheet.
Edited version at the same link.
 
Herbert, Hector thanks for your help. I am learning macros, but am still a
beginnner, so I used the formula method and it has worked well. At the end I
get
a brass c d e
101 INDUSTRIES brass
LIGHTING HOME nickel
FRANKFURT brass nickel stainless copper
Jersey copper
Dallas nickel stainless cooper brass

Now I am trying to sort them into columns to clean them up. I want to end up
with

stainless brass silver copper nickel
101 INDUSTRIES brass
LIGHTING HOME nickel
FRANKFURT stainless brass copper nickel
Jersey copper
Dallas stainless brass copper nickel



Now I am trying to use an IF formula to organize them. The formula I am
using only seems to pick the selection from the beginning of the array.


The statment i am using is =IF($b2:$e2="stainless", "stainless", "") What am
I doing wrong?
 
Mea Culpa,
Reorganized version:
http://www.savefile.com/files/1883361
You might also like the alternate method shown:
Requires no formulas, no code, no helper columns,
no conditional formatting and no defined names.
Slight loss in presentation, but big gain in flexibility.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top