Reputation: 1520
I want to use IFS
and Query in google sheet at the same time.
=QUERY('PN Orders'!A1:AF,"SELECT C, D where C LIKE '%" & $B$1& "%' and D LIKE '%" & $B$2& "%' LIMIT " &$B$3,1)
above query works well, get results. But every time I combine it with IFS function, it returns nothing.
=ifs( and($B$1<>"",$B$2<>"")=true, QUERY('PN Orders'!A1:AF,"SELECT C, D where C LIKE '%" & $B$1& "%' and D LIKE '%" & $B$2& "%' LIMIT " &$B$3,1))
Is there something I'm missing here?
Why the query returns nothing when combined with IFS
function?
Upvotes: 2
Views: 4041
Reputation: 1
IFS
is "array kind of type" formula. what you need in your scenario is simple IF
statement:
=IF((B1<>"")*(B2<>""),
QUERY('PN Orders'!A1:AF,
"select C,D
where C like '%"&B1&"%'
and D like '%"&B2&"%'
limit "&B3, 1), "enter name and phone")
or perhaps like this:
=IF((B1<>"")+(B2<>""),
QUERY('PN Orders'!A1:AF,
"select C,D
where C like '%"&B1&"%'
and D like '%"&B2&"%'
limit "&B3, 1), "enter name or phone")
Upvotes: 2
Reputation: 38130
The main problem on your second formula is that is mixing a scalar comparison (single value) with an array of values when both arguments should be of the same type.
Upvotes: 1