Concatenate Numerous rows based off cells value

SlightlyClueless

New Member
Joined
Dec 10, 2018
Messages
15
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have a fairly large worksheet (around 4200 rows) of site access data that needs to be compiled in a specific way. I will try to explain this as best I can below. In summary, I need help with a concatenate formula that will concatenate rows based off the value in column B.

Link to sample workbook

Column A, "Site ID", lists the unique site identifier.
Column B, "Access Order", this lists the progression of access requirement. This can range from 1-7. So for instance a site may have 3 steps for access. It would show as

Site ID Access Order
ABC123 1
ABC123 2
ABC123 3

Column C, "Access Type", This lists the type of access point they will face
Column D, "Code", This is the code or notes for that point of access
Column E, "Key", This identifies the key type if applicable
Column F, "Concate Access & Code", Concatenates column C & D
Column G, "Concat All", This Would concatenate the data for each point of access based off of how many point of access their are (Column B). So if the highest number listed for a site is 5, it would concatenate the all 5 points of access for that specific site.


Site IDAccess_OrderAccess TypeCodeKeyConcat Access & CodeConcat All
2227221Compound and cabinets1234Access Order - 1
Compound and cabinets - Code: 1234
2233011Compound Gate4567Key Type - ComboAccess Order - 1
Key Type - Combo
Compound Gate - Code: 4567
2233012Shelter Door55-aKey Type - KeyAccess Order - 2
Key Type - Key
Shelter Door - Code: 55-a
Access Order - 1
Key Type - Combo
Compound Gate - Code: 4567

Access Order - 2
Key Type - Key
Shelter Door - Code: 55-a
2233021Compound Gate1234Key Type - ComboAccess Order - 1
Key Type - Combo
Compound Gate - Code: 1234
2233022Shelter Door55-aKeybox/Lockbox Location - Magnetic key box under HVAC unit
Key Type - Key
Access Order - 2
Keybox/Lockbox Location - Magnetic key box under HVAC unit
Key Type - Key
Shelter Door - Code: 55-a
Access Order - 1
Key Type - Combo
Compound Gate - Code: 1234

Access Order - 2
Keybox/Lockbox Location - Magnetic key box under HVAC unit
Key Type - Key
Shelter Door - Code: 55-a
2233031Compound Gate1234Key Type - ComboAccess Order - 1
Key Type - Combo
Compound Gate - Code: 1234
2233032AC Meter Compound Gate55aKey Type - KeyAccess Order - 2
Key Type - Key
AC Meter Compound Gate - Code: 55a
2233033Shelter Door55aKeybox/Lockbox Location - Shelter key is located in a magnetic key box under one of the HVAC units.
Key Type - Key
Access Order - 3
Keybox/Lockbox Location - Shelter key is located in a magnetic key box under one of the HVAC units.
Key Type - Key
Shelter Door - Code: 55a
Access Order - 1
Key Type - Combo
Compound Gate - Code: 1234

Access Order - 2
Key Type - Key
AC Meter Compound Gate - Code: 55a

Access Order - 3
Keybox/Lockbox Location - Shelter key is located in a magnetic key box under one of the HVAC units.
Key Type - Key
Shelter Door - Code: 55a
2233041compound gate1234Key Type - comboAccess Order - 1
Key Type - combo
compound gate - Code: 1234
2233042shelter door55AKey Type - keyAccess Order - 2
Key Type - key
shelter door - Code: 55A
2233043Vendor accesslocated under HVAC unit with Shelter KeyKey Type - Magnetic Lock boxAccess Order - 3
Key Type - Magnetic Lock box
Vendor access - Code: located under HVAC unit with Shelter Key
Access Order - 1
Key Type - combo
compound gate - Code: 1234

Access Order - 2
Key Type - key
shelter door - Code: 55A

Access Order - 3
Key Type - Magnetic Lock box
Vendor access - Code: located under HVAC unit with Shelter Key
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hello, below is a cumbersome attempt for "Concat All" (to be insterted in G2 and dragged down):

Excel Formula:
=LET(
ID,$A$2:$A$12,
ORDER,$B$2:$B$12,
TYPE,$C$2:$C$12,
CODE,$D$2:$D$12,
KEY,$E$2:$E$12,
a,IF(MAXIFS(ORDER,ID,A2)=B2,B2,""),
b,SEQUENCE(ROWS(ID)),
c,"Access Order - "&CHOOSEROWS(ORDER,SORT(SEQUENCE(a,,XLOOKUP(A2&B2,ID&ORDER,b),-1))),
d,CHOOSEROWS(CODE,SORT(SEQUENCE(a,,XLOOKUP(A2&B2,ID&ORDER,b),-1))),
e,CHOOSEROWS(TYPE,SORT(SEQUENCE(a,,XLOOKUP(A2&B2,ID&ORDER,b),-1)))&" - Code: "&d,
f,CHOOSEROWS(KEY,SORT(SEQUENCE(a,,XLOOKUP(A2&B2,ID&ORDER,b),-1))),
g,IF(ISNUMBER(CHOOSEROWS(ORDER,SORT(SEQUENCE(a,,XLOOKUP(A2&B2,ID&ORDER,b),-1)))),""),
h,HSTACK(c,f,e,g),
i,TEXTJOIN(CHAR(10),FALSE,h),
IFERROR(TEXTBEFORE(i,CHAR(10),LEN(i)-LEN(SUBSTITUTE(i,CHAR(10),""))),""))

Not sure if it is meant seriously but you could test it...
 
Upvote 0
Solution

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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