, если вы хотите использовать оператор IF
, тогда:
=IF(B3<>"", QUERY(Company_overview!A2:L,
"where B = '"&B3&"'
and L >= datetime '"&TEXT(TODAY()-B4, "yyyy-MM-dd hh:mm:ss")&"'
and L <= datetime '"&TEXT(NOW(), "yyyy-MM-dd hh:mm:ss")&"'", 1),
QUERY(Company_overview!A2:L,
"where L >= datetime '"&TEXT(TODAY()-B4, "yyyy-MM-dd hh:mm:ss")&"'
and L <= datetime '"&TEXT(NOW(), "yyyy-MM-dd hh:mm:ss")&"'", 1))
или, возможно:
=QUERY(Company_overview!A2:L,
"where "&IF(B3<>"", "B = '"&B3&"' and ", )&"
L >= datetime '"&TEXT(TODAY()-B4, "yyyy-MM-dd hh:mm:ss")&"'
and L <= datetime '"&TEXT(NOW(), "yyyy-MM-dd hh:mm:ss")&"'", 1)