Nested If Then Else Statement
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Is it possible to create an If Then Else statement that allows for more than three conditions? For example, I need to create an If Then Else statement that looks at a number and determines if it falls in the following buckets; late, on-time, within 30 days, between 31 and 60 days, between 61 and 90 days, and greater than 90 days.
Thanks!!
Solved! Go to Solution.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The parnthese aren't needed either - just there for clarification. Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You should also check out the tile tool for quickly creating custom range bands like that. Assuming you have (or used a formula to create) a field that is numeric (ex. days late), then in the tile tool, you can pick 'Manual' for the tile method then just type your cutoffs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If arg1 then result1 elseif
arg2 then result2 elseif
arg3 then result3 else
default
endif
with dates you can use <= as once 30 days is used in an argument , when you check for 60 days the result must be between 30 and 60.
Just a thought for you.
Thanks,
Mark
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello there!
Good topic
I have a statement that will create a column of day ranges but it will only create 2 ranges for some reason.
It seems to like only the "Over 180" and the "0-30" I have several others that just wont compute out.
Also the 2 groupings are not lining up with the days they are supposed to be lined up with
The [Days Open] field is the result of 2 diff dates calculated in 'days'
If [Days Open] >= '180' THEN "Over 180" elseif [Days Open] >= '90' THEN "90-180" elseif [Days Open] >= '60' THEN "60-90" elseif [Days Open] >= '40' THEN "40-60" elseif [Days Open] >= '30' THEN "30-40" elseif [Days Open] >= '0' THEN "0-30" Else [Days Open] ENDIF
Any help would be extremely appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You don't need single quotes around your conditions. Doing so interprets you difference of date as a number, and then your nested IF THEN ELSEIF statement is working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Perfect and Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I have a CSV file with column PDPDESC which has values I (stands for Inconsistent), S( stands for Satisfactory) and L (Leading Performance). Below was a formula I added to my existing workflow to include this particular metric:-
IF [PDPDESC]="I" THEN "INCONSISTENT PERFORMANCE" ELSE(IF [PDPDESC]="S" THEN "SATISFACTORY PERFORMANCE" ELSE (IF [PDPDESC]="L" THEN "LEADING PERFORMANCE" ELSE "N/A" ENDIF) ENDIF
It still gives me Parse Error when I try IF c THEN t ELSEIF c2 THEN t2 ELSE f ENDIF. Then tried using the above formula but gives me "Unmatched ( " error.
Need some help on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You have 3 IF but only 2 ENDIF
You opened 2 (, but only closed one;
Try indenting your code. You'll see not all is closed :)
IF [PDPDESC]="I"
THEN "INCONSISTENT PERFORMANCE"
ELSE(
IF [PDPDESC]="S"
THEN "SATISFACTORY PERFORMANCE"
ELSE (
IF [PDPDESC]="L"
THEN "LEADING PERFORMANCE"
ELSE "N/A"
ENDIF)
ENDIF
With this in mind you can complete your code - one ) and one ENDIF missing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Perfecto ! Thanks bro
