Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional formatting with QUERY result in Google Spreadsheet

I have a spreadsheet with 1 sheet of software version an another sheet of installation records. I want to do a conditional formatting that compares the version of in installation (on column F) to its know latest version number on another sheet ('Software Versions').

Current Solution

I came up with this formular initially:

=AND(F2<>"", F2=G2)

It works. But I need to maintain a column of QUERY results on G2:

=QUERY('Software Versions'!$A$1:$B$8, "Select B where A='" &D4& "' LIMIT 1")

Problem

Now I want to remove the G2 row altogether. I came up with this combined query:

=AND(F2<>"", F2=QUERY('Software Versions'!$A$1:$B$8, "Select B where A='" &D4& "' LIMIT 1"))

But I cannot save it because it is an "Invalid Formula":

enter image description here

Any way to actually do it?

like image 982
Koala Yeung Avatar asked Mar 10 '23 14:03

Koala Yeung


1 Answers

Try use this formula:

=AND(F2<>"", F2=IFERROR(QUERY(INDIRECT("'Software Versions'!$A$1:$B$8"), "Select B where A='" &D4& "' LIMIT 1 label B ''"),""))

I was able to make conditional formatting with this formula.

Improvements

  1. Use indirect to address another sheet
  2. Use label B '' to prevent header appear as query result
  3. Use iferror(..., "") to be sure no error occurs when no data is found with query
like image 199
Max Makhrov Avatar answered Mar 12 '23 02:03

Max Makhrov