Previous Thread
Next Thread
Print Thread
#42698 08/12/14 03:35 PM
Joined: Jan 2013
Posts: 25
L
Adagio Enthusiast
Adagio Enthusiast
L Offline
Joined: Jan 2013
Posts: 25
What is the proper way to use multiple IF/OR/AND statements. In this particular case I want to:

Find {Item #} containing "YX" or "ZB" or "TV" and {Amt} * 2%
Everything thing else I want {Amt} * 3.25%

I can get one function working:

IF(
FIND("YX",{Item #},1),
{Amt} * 2%,
{Amt} * 3.25%
)

But I am unsure on how to add the other two.

Thanks,


Lance Tennier
TDL Canada
Joined: Aug 2011
Posts: 476
Joined: Aug 2011
Posts: 476
Looks like you want to insert the OR function for the first parameter of the IF statement, for its arguments you'll replicate that find function once per each string you are searching for:
IF(
OR(Find#1, find#2, find#3),
do x,
do y
)


Warren
Stief Group
Joined: Jan 2013
Posts: 25
L
Adagio Enthusiast
Adagio Enthusiast
L Offline
Joined: Jan 2013
Posts: 25
Thanks Warren,

I tried:

IF(
OR(
FIND("YX",{Item #},1),
FIND("ZB",{Item #},1),
FIND("TV",{Item #},1),
)
{Amt} * 2%,
{Amt} * 3.25%
)

I cannot get it to verify. What would be the error?

Thanks,


Lance Tennier
TDL Canada
Joined: Mar 1999
Posts: 11,746
Adagio Action Team
Adagio Action Team
Joined: Mar 1999
Posts: 11,746
Remove the comma after the last FIND statement:

IF(
OR(
FIND("YX",{Item #},1),
FIND("ZB",{Item #},1),
FIND("TV",{Item #},1)
)
{Amt} * 2%,
{Amt} * 3.25%
)


Regards,
Softrak Tech Support
Joined: Jan 2013
Posts: 25
L
Adagio Enthusiast
Adagio Enthusiast
L Offline
Joined: Jan 2013
Posts: 25
I hate to be a pain, but I have copied that exact formula into Gridview and I still fail the verification.


Lance Tennier
TDL Canada
Joined: Jun 2004
Posts: 3,692
B
Adagio Wizard
Adagio Wizard
B Offline
Joined: Jun 2004
Posts: 3,692
IF(
OR(
FIND("YX",{Item #},1) > 0,
FIND("ZB",{Item #},1) > 0,
FIND("TV",{Item #},1) > 0
)
{Amt} * 2%,
{Amt} * 3.25%
)

Joined: Aug 2011
Posts: 476
Joined: Aug 2011
Posts: 476
Lance,
I think the issue is that all of the if statements posted after my initial reply are lacking the comma to separate out the OR function as the #1 parameter of the IF statement. You had the correct number of commas the first time, just not in the right place:
If (
Or (find(xxxx)) ,
do x,
do y
)

I haven't used the find function in a little bit but Bruce's suggestion of ensuring the find functions are returning a value >0 is worth considering. The if statement might recognize the returned 0 as false and go to the final part without that, but I'm not sure.


Warren
Stief Group
Joined: Jun 2004
Posts: 3,692
B
Adagio Wizard
Adagio Wizard
B Offline
Joined: Jun 2004
Posts: 3,692
Yes, Warren is correct (he has younger eyes). smile The comma was missing.

IF(
OR(
FIND("YX",{Item #},1) > 0,
FIND("ZB",{Item #},1) > 0,
FIND("TV",{Item #},1) > 0
),
{Amt} * 2%,
{Amt} * 3.25%
)

Joined: Feb 2008
Posts: 1,247
Adagio Maestro
Adagio Maestro
Joined: Feb 2008
Posts: 1,247
Thanks guys! It's working perfect now. 8-)


Susan Tennier
TDL Canada
Trenton, Ontario

Moderated by  Softrak Support 

Link Copied to Clipboard
Who's Online Now
0 members (), 77 guests, and 3 robots.
Key: Admin, Global Mod, Mod
Forum Statistics
Forums5
Topics14,679
Posts71,625
Members1,874
Most Online1,408
Dec 9th, 2025
November
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Powered by UBB.threads™ PHP Forum Software 8.0.0