30 Advanced Excel Tips for 2026

Excel Champs / Excel Formulas List / Use CONCATENATE IF (Combine with Condition) Formula in Excel
By Puneet Gogia (Microsoft MVP)

Use CONCATENATE IF (Combine with Condition) Formula in Excel

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

There’s no CONCATENATEIF function, and CONCATENATE itself can’t take an array, so the combination is built with IF inside CONCAT or TEXTJOIN. TEXTJOIN is the better choice because it adds a delimiter and skips blanks: =TEXTJOIN(", ",TRUE,IF(A1:A4="A",B1:B4,"")) joins every value in column B where column A says “A”.

The IF returns the matching values and empty strings for the rest, and the TRUE tells TEXTJOIN to ignore those empties. Use CONCAT instead if you want the values run together with no separator: =CONCAT(IF(A1:A4="A",B1:B4,"")).

On Excel 2019 or earlier both need to be entered with Ctrl+Shift+Enter, since IF is working across a range; on Excel 365 and 2021 a plain Enter is enough. In 365 there’s a cleaner version worth preferring: =TEXTJOIN(", ",TRUE,FILTER(B1:B4,A1:A4="A")) — FILTER does the selecting, which reads much closer to the intent and avoids the array-entry question entirely.

In Excel, there are two ways to use a concatenate IF formula.

  • By Column
  • By Rows

And we have two different functions to write these formulas. So, in this tutorial, we will learn all four methods.

Both CONCAT and TEXTJOIN are available in Excel 2019, Excel 2021 and Microsoft 365. In Microsoft 365 and Excel 2021, you can simply press Enter. In Excel 2019, these formulas work with an array inside IF, so you need to press Ctrl + Shift + Enter instead of Enter.

Concatenate with IF using CONCAT Function

1. By Column

This formula is quite simple. Here we are testing whether the value in cell A1 is “A”. And if it is, the formula combines the values from columns A and B.

concatenate-with-if

We have used the CONCAT and IF functions. In the IF function, we have specified a condition to test whether the value in cell A1 is “A”.

concate-and-if-combined

And if the value is A, then return the range A1:B1; otherwise, a blank value. In the end, CONCAT uses the range returned by IF and combines values from it.

=CONCAT(IF(A1="A",A1:B1,""))

2. By Rows (+ Columns)

Now let’s say you want to concatenate values from all rows using a condition. In this case, you can use the same formula but must refer to the entire range.

concatenate-values-using-a-condition
=CONCAT(IF(A1:A4="A",A1:B4,""))

In this formula, IF checks for the value “A” in the entire range A1:A4. It gives TRUE for the cells with the value and FALSE for the rest.

concat-with-if-to-check-condition

And then, it returns the rows from the range A1:B4 where the value is “A” in column A.

returned-rows-per-applied-condition

Concatenate with IF using TEXTJOIN Function

1. By Columns

Once you insert the TEXTJOIN function, you need to specify the delimiter, and also whether you want to ignore blank cells or not. After that, you need to use the IF function as you have used in the previous method.

concatenate-with-if-using-textjoin
=TEXTJOIN(",",TRUE,IF(A1="A",A1:B1,""))

IF only returns the values from the range if a cell in column A has the value “A”.

2. By Rows

And in the same way, you can concatenate values from multiple rows using a condition. For example, in the below formula, you have referred to the entire range A1:A4 for the condition to test, and to the range A1:B4 for the values to combine.

=TEXTJOIN(",",TRUE,IF(A1:A4="A",A1:B4,""))
textjoin-with-if-by-rows

In the result, we have the values A,1,A,3, from the cells A1, B1, A3, and B3. With the IF function, we have tested a condition in column A. It returns the values for the rows where the cell value in column A is “A”.

concatenate-resulted-value

TEXTJOIN ignores the blank values and, using the delimiter, combines all the values as one.

Join Names That Match a Condition

A common use of this formula is to list all the names that belong to a category in one cell. Let’s say you have names in D2:D6 and departments in E2:E6. The following formula returns all the names from the Sales department, separated by a comma and a space:

=TEXTJOIN(", ",TRUE,IF(E2:E6="Sales",D2:D6,""))

Put the department name in a cell, like G1, and use E2:E6=G1 in the condition, so you can change the department without editing the formula.

Use FILTER with TEXTJOIN (Microsoft 365)

In Excel 2021 and Microsoft 365, you can use FILTER instead of IF. It returns only the matching values, so the formula is easier to read:

=TEXTJOIN(", ",TRUE,FILTER(D2:D6,E2:E6="Sales",""))

And to list each name only once, wrap FILTER in UNIQUE:

=TEXTJOIN(", ",TRUE,UNIQUE(FILTER(D2:D6,E2:E6="Sales","")))

Frequently Asked Questions

Why does my CONCAT IF formula return #NAME?

CONCAT and TEXTJOIN aren’t available in Excel 2016 and earlier. In those versions, use the & operator with IF in a helper column, or upgrade to a newer version.

Why do I get only the first value instead of all of them?

In Excel 2019, you need to press Ctrl + Shift + Enter to enter the formula as an array formula. With only Enter, IF checks just one cell.

Can I use more than one condition?

Yes. Multiply the conditions inside IF, like IF((E2:E6=”Sales”)*(F2:F6=”North”),D2:D6,””).

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel

Leave a Comment