2

I'm having trouble with a QUERY formula in Google Sheets.

I have fruit-specific sheets named Apples, Pears, and Plums that contain both data and images.

I am trying to pull the combined data and images from those sheets into another sheet Main but I can't my formula to work properly.

Sample Data

Sheet:  Plums

The other fruit sheets (Apples and Pears) contain the same columns with different data.

A B C D E F G
1 Fruit Color Size(см) Quantity Quality Country
2 Plums
3 Plum Red 7 32 2 AU Flag
4 Plum Yelow 2 5 5 BR Flag
5 Plum Green 5 3 3 CA Flag

Desired Result

Sheet:  Main

With data queried from sheets Apples, Pears, and Plums
Desired result

My Formula in Main!A2

=QUERY({APPLES!A2:G; PEARS!A2:G; PLUMS!A2:G}; 
  "Where Col1 is not Null OR Col3 is not Null"; 0)

My formula's incorrect result: Current result

Please advise on how to correct my formula to get the desired result.

0

1 Answer 1

1

The query() function returns images as null values. Use filter() instead, like this:

=let( 
  data; vstack('APPLES'!A2:G; 'PEARS'!A2:G; 'PLUMS'!A2:G); 
  filter(data; len(choosecols(data; 1)) + len(choosecols(data; 2)) + len(choosecols(data; 3))) 
)

See let(), vstack(), filter() and choosecols().

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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