There are some built-in functions like the CONCATENATE function to concatenate cells in Google Sheets when all the cells have some values. But occasionally, things might be changed. There may be values in some of the cells and emptiness in others. And we have to join only the non-empty cells. Therefore we can not use those functions directly. We have to modify them a little bit. So in this article, we’ll see 7 useful ways to concatenate if the cell is not blank in Google Sheets with clear steps and images.
A Sample of Practice Spreadsheet
You can download Google Sheets from here and practice very quickly.
7 Useful Ways to Concatenate If Cell Is Not Blank in Google Sheets
Let’s get introduced to our dataset first. Here we have some products in Column B. if you notice, you may find some blank cells in Column B among those products. Now we want to join these products and put them in a single cell with some separator like comma or dash and also want to ignore the blank cells. So, I’ll show you 7 useful examples to concatenate if the cell is not blank in Google Sheets by using this dataset.
1. Using TEXTJOIN Function
First and foremost, we can use the TEXTJOIN function to concatenate if the cell is not blank in Google Sheets. This function directly ignores the empty cells and only connects those cells which have any values in them. We can also put a separator like a comma into this function by which we want to join our desired values. Let’s see the steps.
- Firstly, type the following formula in Cell B13–
- Secondly, hit Enter to get the result.
- Finally, you’ll see all the products have concatenated in Cell B13 with the separator comma and ignored the blank cells.
2. Combining JOIN, FILTER and NOT Functions
Apart from the previous method, we can combine the JOIN, FILTER and NOT functions together to concatenate if the cell is not blank in Google Sheets. These functions together serve the same purpose as the previous method does. Let’s see how to do it.
- At first, select Cell B13 and write the following formula there-
- Then, press Enter to get the output.
- At last, we neglect the blank cells and concatenate all the products in Cell B13 with the separator comma.
Initially, this function returns the non-blank cells from Cells B5 to B10.
Moreover, this function filters the values it gets from the NOT function.
Lastly, this function joins the values from the non-blank cells with the separator comma from Cells B5 to B10.
3. Merging JOIN and SPLIT Functions
We can further merge the JOIN and SPLIT functions instead of the FILTER function to connect the non-empty cells in Google Sheets. As well as we’ll add the separator comma into our formula to separate the connected values.
- First of all, activate Cell B13.
- Next, insert the following formula there-
- After that, click Enter to obtain the result.
- In the end, we ignore the empty cells and combine all the products in Cell B13 with a comma as the separator.
Firstly, this function joins all the cells from Cells B5 to B10.
Then, this function splits all the values it gets from the JOIN function and removes the empty values.
Finally, this function again connects the non-empty values that it gets from the SPLIT function within Cells B5 to B10.
4. Using Nested IF Functions
At this moment I’ll use multiple IF functions together which are called nested IF functions to join the non-blank cells. We know that IF is a logical function. We normally use it to get some result by putting a condition. So the nested IF functions can be used to insert multiple conditions one by one. The problem with using this method is that we have to insert every cell separately into our formula. That is quite irritating and lengthy.
- In the beginning, put the formula below in Cell B13–
- Consequently, hit Enter to get the output.
- Ultimately, by concatenating all the products in Cell B13 with a comma as a separator, we ignore the blank cells as you can see in the picture.
- How to Get Opposite of Concatenate in Google Sheets (2 Ways)
- How to Concatenate Double Quotes in Google Sheets (3 Ways)
- Google Sheets QUERY Function to Concatenate Two Columns
5. Combining IF, AND, NOT, ISBLANK and CONCATENATE Functions
Now, we have a different dataset. Here we have some products in Column B and some prices in Column C. If you look closely, you could see some empty cells in Columns B and C. Now we want to concatenate the product and price with a separator dash in Column D by ignoring the blank cells. We can do this by combining the IF, AND, NOT, ISBLANK, and CONCATENATE functions together. Below you’ll see the steps for doing so.
- Before all, start by entering the formula below in Cell D5–
- Again, press Enter to obtain the result.
- ISBLANK(B5), ISBLANK(C5)
Firstly, these functions will check if Cells B5 and C5 are blank or not.
- NOT(ISBLANK(B5)), NOT(ISBLANK(C5))
Then, these functions will check whether Cells B5 and C5 have values or not.
Next, this function returns TRUE when all these 2 conditions are right, otherwise FALSE.
This function connects Cells B5 and C5 with the separator dash.
Finally, the IF function will give the output as a connected cell if the logic is TRUE otherwise it’ll ignore the cell.
- Then, apply the Fill Handle tool to use the formula in the rest of the cells of Column D.
- Last but not least, you’ll see the combination of all the products and prices in Column D with a separator dash. You’ll also see that the formula has ignored those products or prices that have corresponding blank cells.
6. Uniting ARRAYFORMULA and IF Functions
Unlike the previous example, we can unite the ARRAYFORMULA and IF functions to concatenate if the cell is not blank in Google Sheets. This method is faster than the previous method because here we are getting the output with just a single click. We don’t have to use any Fill Handle tool here.
- Earlier on, begin by typing the following formula in Cell D5–
- Next, hit Enter to see the outcome at once.
- Now you are getting the result with just a single click.
- IF((B5:B10<>””)*(C5:C10<>””), B5:B10&”-“&C5:C10,)
Firstly, this function checks the values from Cells B5 to B10 and Cells C5 to C10 are empty or not. If there are values at the cells in both Columns B and C, then it joins them in Column D with a separator dash.
- ARRAYFORMULA(IF((B5:B10<>””)*(C5:C10<>””), B5:B10&”-“&C5:C10,))
Finally, this function makes the formula an array and expands the results quickly throughout the range.
7. Applying CONCATENATE Function
At this moment we have the year, date of birth, project code, joining date, and serial number of a certain employee of a company in Column C. Some pieces of information are missing as you can see in the picture. We want to make an employee id with these pieces of information. So we have to join these values in a single cell. We can use the CONCATENATE function for this purpose. This function concatenates multiple cells without any separator. The only problem with using this function is that we can not use any separator among the values. All the values will connect one by one.
- Initially, select Cell C10.
- After that, insert the following formula-
- Again, to get the output, press Enter.
- You’ll get the employee id in Cell C10. If we add the missing information such as the date of birth, then it will automatically add to the employee id in Cell C10.
That’s all for now. Thank you for reading this article. In this article, I have discussed 7 useful ways to concatenate if the cell is not blank in Google Sheets. Please comment in the comment section if you have any queries about this article. You will also find different articles related to google sheets on our officewheel.com. Visit the site and explore more.
- How to Concatenate Strings with Separator in Google Sheets
- How to Concatenate in Google Sheets (6 Suitable Ways)
- How to Concatenate Text and Formula in Google Sheets (7 Ways)
- How to Append Text in Google Sheets (An Easy Guide)
- How to Concatenate Number and String in Google Sheets
- How to Concatenate Strings in Google Sheets (2 Easy Ways)