Posts

Showing posts with the label concatenate with condition

ExcelFu - Concatenate string with condition

How can I achieve table #2 from table #1 in Excel? TABLE1 => TABLE2  Name No. No. Name A 1 1 A,D,K B 2 2 B,G,H,I C 3 3 C,E,F D 1 E 3 F 3 G 2 H 2 I 2 K 1 There are 2 things I need to do to create table 2: 1. Filter TABLE2 by No. column 2. Concatenate those records which have the same No. But, with the built-in functions set of Excel spreadsheet, I can only do 1 thing at a time. I meant I can only concatenate string without condition or only filter records without concatenate the results. So, the only way is to create a User Define Function : 1. Press ALT+F11 in excel to open the Microsoft Visual Basic window. 2. Click Insert menu > Module and define the ConcatenateIf function: Function ConcatenateIf (CriteriaRange As Range, Condition As Variant, _         ConcatenateRange As Range, Optional Separator As String = ",") As Variant     Dim i As L...