Have a sheet with approx. 900+ rows. I need a formula that will automatically transpose items horizontally if the address is the same. (see pic)

bgiovanni1

New Member
Joined
Dec 11, 2019
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I am trying to save lots of time and headache, so any help is appreciated! There are many addresses that have multiple tenants. I need the tenants horizontally transposed into the same row so that I can use this as a mail merge. I guess part two of this is that it would be great to also have a way to quickly and easily delete the other duplicates after this is done without having to do it manually, but that is not as important. Thank you in advance for your help!

Brenda :)
Excel hel no 2.png
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Welcome to the Board!

Try this macro.
Results in cell M2 down

VBA Code:
Sub transpose_items()
  Dim a() As Variant, dic As Object, ky As Variant
  Dim v As Long, i As Long, j As Long
 
  a = Range("A2:J" & Range("A" & Rows.Count).End(xlUp).Row).Value
  Set dic = CreateObject("Scripting.Dictionary")
 
  For i = 1 To UBound(a, 1)
    dic(a(i, 10)) = dic(a(i, 10)) & a(i, 1) & "|"
  Next
  j = 2
  For Each ky In dic.keys
    v = Len(dic(ky)) - Len(Replace(dic(ky), "|", ""))
    Range("M" & j).Resize(1, v).Value = Split(dic(ky), "|")
    Range("V" & j).Value = ky
    j = j + 1
  Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top