Filter Rows If All the Columns Have Text Content in Google Sheets

In Google Sheets, the Query function is widely used for different data manipulation techniques. But have you ever wondered how to filter rows if all the columns have text content? Well, let me introduce you to a unique way to achieve this.

The Challenge: Filtering Rows with Text Content Only

Imagine you have a spreadsheet with various data, including text, numbers, and even blank cells in different columns. Now, you want to filter out the rows that contain only text in all the columns. This can be quite a tricky task, but with the right approach, it can be done.

Filter rows that only having text in Google Sheets

In the example above, we want to filter the rows that only contain text. As you can see, rows 3 and 5 meet this criterion, while the others have a mixture of text, numbers, and blank cells.

The Solution: Using the Query Function with ISTEXT

To filter rows that have text content in all the columns of Google Sheets, we need to go beyond just using the Query function. We’ll also make use of the ISTEXT function to perform a logical test. Here’s how you can do it:

Step 1: Check if a Cell Contains Text

The first step is to determine if a cell contains text or not. You can use the ISTEXT function for this. Here’s the formula:

=ISTEXT(A2)

This formula will return TRUE if the cell contains text and FALSE otherwise. But how can we apply this formula to an array or multiple columns?

=ArrayFormula(ISTEXT(A2:D6))

In the example above, we have four columns, so we can use the ISTEXT formula for a four-column range. This formula will only return TRUE or FALSE for each cell.

Step 2: Filtering the Rows

Now, let’s use the IF logical function with the ISTEXT array formula to return text values wherever the ISTEXT formula returns TRUE. Similarly, we’ll return blank cells wherever the ISTEXT formula returns FALSE. Here’s the formula:

=ArrayFormula(IF(ISTEXT(A2:D6),A2:D6,))

This formula will give us the desired output.

Step 3: The Final Filter

Here comes the final step of filtering rows that have text content in all the columns of Google Sheets. You can use the Query formula on the result obtained in the previous step. The filter conditions in Query are as follows:

Filter columns A, B, C, and D if the cell contents in those rows are not blank. Here’s the formula:

=QUERY(ArrayFormula(IF(ISTEXT(A2:D),A2:D,)),
"SELECT * WHERE Col1<>'' AND Col2<>'' AND Col3<>'' AND Col4<>''")

This formula, applied to cell F2 in this example, will filter out the rows that only have text values.

Additional Tips to Filter Rows

You have already learned how to filter rows that have text content. Now, let’s explore how you can filter rows that only have number values. Here are some minor changes to the formula:

=QUERY(ArrayFormula(IF(ISNUMBER(A2:D),A2:D,0)),
"SELECT * WHERE Col1>0 AND Col2>0 AND Col3>0 AND Col4>0")

In this case, we replace the ISTEXT formula with the ISNUMBER formula. Additionally, the logical clause in the Query has changed from <> to >0.

Conclusion

Congratulations! You’ve learned how to filter rows that have text or number values only in Google Sheets. By making use of Google Sheets info functions like ISTEXT and ISNUMBER, you can achieve this goal. There may be alternative solutions, but this approach works effectively.

Feel free to explore other possibilities and enjoy the power of Google Sheets!

To learn more about Google Sheets and discover other helpful tips and tricks, visit Crawlan.com. Happy filtering!

Related posts