slug0r
asked on
If-Then-Else statement. If {field} = "Customer" then do these 3 if statements, If not then these other If statements.
Hello,
Here is my formula:
if {CUSTOMER} = "ABC" then
if {@datediff} < 5 then "Early" else
if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 then "Late" else
if {SFC2.C2_NUM} = "DEF" then
if {@datediff} < 3 then "Early" else
if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 then "Late"
I'm trying to make my formula to do diffrent calculations depending on the rules of the customer, as you can see customer ABC can be sent in 5 days early and DEF can be 3 days early.
Also all over customers will be 0 days early.
Phil.
Here is my formula:
if {CUSTOMER} = "ABC" then
if {@datediff} < 5 then "Early" else
if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 then "Late" else
if {SFC2.C2_NUM} = "DEF" then
if {@datediff} < 3 then "Early" else
if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 then "Late"
I'm trying to make my formula to do diffrent calculations depending on the rules of the customer, as you can see customer ABC can be sent in 5 days early and DEF can be 3 days early.
Also all over customers will be 0 days early.
Phil.
ASKER
Hello Pete,
This formula i have does'nt work, it shows me when "ABC" are Late / Early or On Time but it doesn't show me the information for DEF and all the other customers.
I'll try explain diffrently here. Ok i have customers ABC / DEF / GHI and each customer has diffrent rules ABC can be delivered 5 days early and DEF can be sent 3 days early and GHI can be sent 0 days early, i have a field that tells me how many days we have delivered early, i want a formula that says if ABC is < 5 days then show "Early" then if = 0 then "On time" then if > 0 then "Late" and then if DEF < 3 days then show "Early" then if = 0 then "On time" then if > 0 then "Late".
Phil.
This formula i have does'nt work, it shows me when "ABC" are Late / Early or On Time but it doesn't show me the information for DEF and all the other customers.
I'll try explain diffrently here. Ok i have customers ABC / DEF / GHI and each customer has diffrent rules ABC can be delivered 5 days early and DEF can be sent 3 days early and GHI can be sent 0 days early, i have a field that tells me how many days we have delivered early, i want a formula that says if ABC is < 5 days then show "Early" then if = 0 then "On time" then if > 0 then "Late" and then if DEF < 3 days then show "Early" then if = 0 then "On time" then if > 0 then "Late".
Phil.
if {CUSTOMER} = "ABC"
then
(if {@datediff} < 5 then "Early" else
if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 then "Late")
else if {SFC2.C2_NUM} = "DEF" then
(if {@datediff} < 3 then "Early" else
if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 then "Late")
There are a couple of issues, as I see it from this formula. It might not be working because you have a condition that can be met by two different section.
@datediff = 3
if {@datediff} < 5 then "Early" else = True
if {@datediff} > 0 then "Late") = True
The other thing that might be throwing it off is the fact that you are switching up the columns. This has played havac in some of my reports.
Hope this helps.
then
(if {@datediff} < 5 then "Early" else
if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 then "Late")
else if {SFC2.C2_NUM} = "DEF" then
(if {@datediff} < 3 then "Early" else
if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 then "Late")
There are a couple of issues, as I see it from this formula. It might not be working because you have a condition that can be met by two different section.
@datediff = 3
if {@datediff} < 5 then "Early" else = True
if {@datediff} > 0 then "Late") = True
The other thing that might be throwing it off is the fact that you are switching up the columns. This has played havac in some of my reports.
Hope this helps.
ASKER
Wykabryan,
The formula above works better but now this part doesn't work - if {@datediff} = 0 then "On Time" else.
Whats happening is it shows the < as Early and the > as Late but it doesn't show the = 0 as On time. (it show's them as early).
Phil.
The formula above works better but now this part doesn't work - if {@datediff} = 0 then "On Time" else.
Whats happening is it shows the < as Early and the > as Late but it doesn't show the = 0 as On time. (it show's them as early).
Phil.
if {CUSTOMER} = "ABC"
then
(if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 and {@datediff}<5 then "Early" else "Late")
else if {SFC2.C2_NUM} = "DEF" then
(If {@datediff} = 0 then "On Time" else
if {@datediff}>0 and {@datediff}<3 then "Early" else "Late")
Now this only takes numbers that are greater than 0. I would assume there is no negative numbers.
then
(if {@datediff} = 0 then "On Time" else
if {@datediff} > 0 and {@datediff}<5 then "Early" else "Late")
else if {SFC2.C2_NUM} = "DEF" then
(If {@datediff} = 0 then "On Time" else
if {@datediff}>0 and {@datediff}<3 then "Early" else "Late")
Now this only takes numbers that are greater than 0. I would assume there is no negative numbers.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad i could help
mlmcc
mlmcc
Is there a question here?
Pete