I have a complex formula I am trying to write, and unfortunately it says there is an error in my code, but I can't seem to work out what!
I am trying to write a custom field that says LIVE, FUTURE or COMPLETED depending on the number of days away an event is, and in what region. For example, I want a project to be live if its 180 days away or closer for AUS/NZ, but only want a project to be live at 120 days for EMEA.
Here is the code I have written so far, which doesn't work (for now I have simplified to just be LIVE or COMPLETED, as once I have worked this out I'm sure I'll be able to add future!):
IF(
AND(
(OR(Territory = "SEA",Territory = "AUS/NZ")),
AND( DATETIME_DIFF(RHO, TODAY(), 'days') < 180, DATETIME_DIFF(OPEN, TODAY(), 'days') >= 0),
),
"LIVE",
IF(
AND(
(OR(Territory = "CAN",Territory = "NAM",Territory = "EMEA",Territory = "MENA")),
AND( DATETIME_DIFF(RHO, TODAY(), 'days') < 120, DATETIME_DIFF(OPEN, TODAY(), 'days') >= 0),
),
"LIVE",
IF(DATETIME_DIFF(OPEN, TODAY(), 'days') < 0, "COMPLETED")
)
)
I have tried to combine two pieces of working code to make this.
Code 1 - Showing live or completed just for 120 days or less
IF(
AND( DATETIME_DIFF(RHO, TODAY(), 'days') < 120, DATETIME_DIFF(OPEN, TODAY(), 'days') >= 0), "LIVE",
IF(DATETIME_DIFF(OPEN, TODAY(), 'days') < 0, "COMPLETED")
)
Code 2 - Showing numbers based on concept and region
IF(
AND(
Territory = "EMEA",
(OR(Concept = "A",Concept = "B",Concept = "C"))
),
1900,
IF(
AND(
(OR(Territory = "CAN",Territory = "NAM",Territory = "SEA",Territory = "AUS/NZ")),
(OR(Concept = "A",Concept = "B",Concept = "C"))
),
1650,
IF(
(OR(Concept = "D",Concept = "E")),
15000
)
)
)
Any help or tips would be greatly appreciated! It seems the issue is with nesting an IF statement with both an OR and an AND.
Thanks