Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
smanas
Contributor III
Contributor III

If function with AND/OR

Hello please help me with the below request

Hi, I'm trying to get IDs with certain Zip codes  AND claim codes OR CPT codes 

 

I tried this but giving me an error

=if(match(ZipCD,'77032','77009','77016','77078','77028','77026','77021','77051','77033','77048')
and
If(match(codes,'01700', '01703', '01712')

or

if(match(CPT,'99145', '92610', '9252', '9223', '9221', '9220', '9254', '9257')

then

'Yes', 'No')

Thank you

Labels (3)
1 Solution

Accepted Solutions
MarcoWedel

=if(match(ZipCD,'77032','77009','77016','77078','77028','77026','77021','77051','77033','77048') and (match(codes,'01700', '01703', '01712') OR match(CPT,'99145', '92610', '9252', '9223', '9221', '9220', '9254', '9257')),'Yes', 'No')

View solution in original post

5 Replies
Or
MVP
MVP

It looks like you're using too many if()s. You just need the one.

If(Condition1 AND (Condition2 OR Condition3), 'Yes','No')

smanas
Contributor III
Contributor III
Author

Hi @Or  I think I have some syntax errors can you please help

=if(match(ZipCD,'77032','77009','77016','77078','77028','77026','77021','77051','77033','77048')
and (match(codes,'01700', '01703', '01712') OR match(CPT,'99145', '92610', '9252', '9223', '9221', '9220', '9254', '9257'),'Yes', 'No'))

smanas
Contributor III
Contributor III
Author

I tried this now it does not give me an error but gives me wrong output

=if(match(ZipCD,'77032','77009','77016','77078','77028','77026','77021','77051','77033','77048')
and match(codes,'01700', '01703', '01712') OR match(CPT,'99145', '92610', '9252', '9223', '9221', '9220', '9254', '9257'),'Yes', 'No'))

MarcoWedel

=if(match(ZipCD,'77032','77009','77016','77078','77028','77026','77021','77051','77033','77048') and (match(codes,'01700', '01703', '01712') OR match(CPT,'99145', '92610', '9252', '9223', '9221', '9220', '9254', '9257')),'Yes', 'No')

smanas
Contributor III
Contributor III
Author

Thank you this worked perfectly