1

Regardiung the function below, I want this line AND P < '"&B5&"' to be applied everytime but not when B3="446". I'm not sure how to insert this condition in the query fnction.

=IFERROR(QUERY(BDD!A1:T2972;
"SELECT A,R,B,C,D,E,S,I,T,P,J,K,L 
WHERE A IS NOT NULL 
AND P < '"&B5&"' 
AND 1=1 "&IF(B2="XXXX";"";" AND LOWER(J) = LOWER('"&B2&"') ")&IF(B3="0c";"";" AND LOWER(S) = LOWER('"&B3&"') 
AND NOT(LOWER(J)='PERM' AND T='"&B3&"')
AND I = 'ADMI'
ORDER BY A , P")
;0);"PAS DE RÉSULTAT")
player0
  • 124,011
  • 12
  • 67
  • 124
Mous
  • 155
  • 10

1 Answers1

1

try to replace:

AND P < '"&B5&"'

with:

"&IF(B3*1=446; "1=1"; "AND P < '"&B5&"'")&"
player0
  • 124,011
  • 12
  • 67
  • 124
  • 1
    I tweaked it just a little bit ­­­­­["&IF(C3="446"; ""; " AND P < '"&C5&"'")&"] -- Thank you so much. – Mous Aug 24 '22 at 02:09