I'm attempting to combine two columns from another sheet into one through the QUERY function. My plan is to make it so if a cell in Col A is empty then a cell in Col B will be substituted.

However, due to my inexperience, I am unable to create the right formula. If anyone can help, it will be much appreciated...

Here is a diagram:


I know about IF(ISBLANK(Sheet1!A1), Sheet1!$B1, Sheet1!$A1) but I'm looking for an alternative method that does not require me to have to copy and paste this formula in Sheet 2 for every row.


Try this simple approach:

=ArrayFormula(IF(LEN(A:A), A:A, B:B))

Given what is shown in your post, that would look like this:

=ArrayFormula(IF(LEN(Sheet1!A:A), Sheet1!A:A, Sheet1!B:B))

If you want to have a directly editable header in A1, place your header in A1 and this version in A2:

=ArrayFormula(IF(LEN(Sheet1!A2:A), Sheet1!A2:A, Sheet1!B2:B))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.