How-To-Conditionally-Concatenate-A-Range How To Conditionally Concatenate A Range

Example

{=TEXTJOIN("",TRUE,IF($C$3:$C$11=E3,$B$3:$B$11,""))}

Generic Formula

{=TEXTJOIN(Delimiter,TRUE,IF(ConditionRange=Condition,Range,""))}

Note: This is an array formula. Do not type out the {} brackets. Hold Ctrl + Shift then press Enter while in Edit Mode to create an array formula. For Mac, use + Shift + Return.
  • Range – This is range of values which we want to concatenate together.
  • Delimiter – This is the delimiter value which we want to use to separate values by in our concatenation. Use empty quotes if we don’t want to use a delimiter.
  • ConditionRange – This is the range of values which we will use to test whether or not to concatenate an item from our Range.
  • Condition – This is the condition to test.

What It Does

This formula will conditionally concatenate a range based on a criteria in another range.

How It Works

IF(ConditionRange=Condition,Range,””) will create an array containing data from the Range when it meets the given condition. In our example this will create the following array.

{"";"E";"X";"";"C";"";"E";"L";""}

TEXTJOIN(Delimiter,TRUE,Array) will concatenate the individual items in the Array and separating them with the chosen Delimiter. Using TRUE as the middle argument will skip any blank cells in the array. In our example TEXTJOIN(“”,TRUE,{“”;”E”;”X”;””;”C”;””;”E”;”L”;””}) results in EXCEL!