
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Multiple if statement with "or" and "and"
Hi All,
My requirement is to create a field and categorize into 2 -Category 1 and Category 2.
1)If Code starts with alphabets then
1.1)if it belongs to Product Group K01 ,it is categorized as Category 1
1.2) if it belongs to Product Group K05 ,it is categorized as Category 2
2)If Code starts with integer 6
2.1)if it belongs to Product Group K01 ,it is categorized as Category 1
3)If Code starts with integer 2
3.1)if it belongs to Product Group K05 ,it is categorized as Category 2
Input:
Product Group Code
K01 YS4341
K05 YS4342
K01 YT0517
K05 YT0518
K01 642130
K05 642130
K01 690802
K05 690802
K01 290802
K05 290802
Output:
Product Group Code Category
K01 YS4341 Category1
K05 YS4342 Category2
K01 YT0517 Category1
K05 YT0518 Category2
K01 642130 Category1
K05 642130
K01 690802 Category1
K05 690802
K01 290802
K05 290802 Category2
Thanks,
Ruma
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I case of the rule looking at a alphabet is the alphabet always a “y” or can it be any alphabet from A to Z.
.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ruma,
Try this expression:
IF(Product = 'K01', 'Category1',
IF(Product = 'K05' and MATCH(LEFT(Group Code,1),'2','6'), 'Category2',
IF(Product = 'K05' and MATCH(LEFT(Group Code,1),'Y'), 'Category2',
NULL())))
Regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
It din't give expected output.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
