Combining data with specific criteria

IanPM

Board Regular
Joined
Dec 12, 2013
Messages
53
I have a list of repeating references that I want to combine based on specific criteria in another sheet. Concatenated & transpose is probably part of the requirement but how do I refence it against a specific criteria not using VBA

Output expectation
Column A Columnb
JohnSlow, Fast
KarlFast,Ok,Slow

So I want to have a formula that can combine the below data in Column B based on criteria data in column A above, so that all Column B data is in single cell based on the Column A criteria. The below must be in summary & reflect as above

Below is the data

Column AColumn B
JohnSlow
JohnFast
KarlFast
KarlOk
KarlSlow
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Easy if you have TEXTJOIN function:

=TEXTJOIN(",",TRUE,IF($A$1:$A$5=A1,$B$1:$B$5,""))

If you dont im not sure i can think of a way to do it with formula.
 
Upvote 0
another approach with Power Query

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Result = Table.TransformColumns(Table.ExpandListColumn(Table.TransformColumns(Source, {{"Column B", Splitter.SplitTextByAnyDelimiter({","}, QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Column B"),{{"Column B", Text.Trim, type text}})
in
    Result
 
Upvote 0
CONCAT?

=LEFT(CONCAT(IF($A$1:$A$5=A1,$B$1:$B$5&",","")),LEN(CONCAT(IF($A$1:$A$5=A1,$B$1:$B$5&",","")))-1)

Other than that id have to use code as i know of no other way.
 
Upvote 0
Is this a VBA option?

if that question is to me I can say: No, this is Power Query (Get&Transform), M-code
update your profile about Excel version. Less troubles.

btw. if TEXTJOIN is not available so CONCAT also
 
Last edited:
Upvote 0
A VBA version of Textjoin by the spreadsheetguru
VBA Code:
Public Function TEXTJOIN(Delimiter As String, Ignore_Empty As Boolean, ParamArray Text1() As Variant) As String
'PURPOSE: Replicates The Excel 2016 Function TEXTJOIN
'SOURCE: www.TheSpreadsheetGuru.com

Dim RangeArea As Variant
Dim Cell As Range

'Loop Through Each Cell in Given Input
  For Each RangeArea In Text1
    If TypeName(RangeArea) = "Range" Then
      For Each Cell In RangeArea
        If Len(Cell.Value) <> 0 Or Ignore_Empty = False Then
          TEXTJOIN = TEXTJOIN & Delimiter & Cell.Value
        End If
      Next Cell
    Else
      'Text String was Entered
        If Len(RangeArea) <> 0 Or Ignore_Empty = False Then
          TEXTJOIN = TEXTJOIN & Delimiter & RangeArea
        End If
    End If
  Next RangeArea

TEXTJOIN = Mid(TEXTJOIN, Len(Delimiter) + 1)

End Function



Link
 
Upvote 0
Unfortunately I don't think the function that I posted works if array entered which the formula steve the fish posted requires to get the desired result.
 
Upvote 0
Mark858, do you have a suggestion on how to update as the option combines all values & seemingly only for 1 criteria not all
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,478
Members
448,967
Latest member
visheshkotha

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