function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CharlieLangCharlieLang 

Time / Value Formula

Hi, 

I'm trying to use the below in a text formula to display the text in a field if a case is logged between certain hours (so i can create an assignment rule to push the case to the correct queue)

IF( VALUE(MID(TEXT(CreatedDate), 12, 2))  <= 00  &&  VALUE(MID(TEXT(CreatedDate), 12, 2)) < 10, "USA", 
IF( VALUE(MID(TEXT(CreatedDate), 12, 2))  <= 10 &&  VALUE(MID(TEXT(CreatedDate), 12, 2)) < 22, "Europe", 
IF( VALUE(MID(TEXT(CreatedDate), 12, 2)) <= 22 &&  VALUE(MID(TEXT(CreatedDate), 12, 2)) < 24, "Asia", "Europe"))
)

 At the moment the field is always stating "Asia" and i am not sure why this is

 
 
Best Answer chosen by Admin (Salesforce Developers) 
TechTrackerTechTracker

It might help you....

 

IF(VALUE(MID(TEXT(CreatedDate), 12, 2)) < 10, "USA",
IF( VALUE(MID(TEXT(CreatedDate), 12, 2)) >= 10 && VALUE(MID(TEXT(CreatedDate), 12, 2)) < 22, "Europe",
IF( VALUE(MID(TEXT(CreatedDate), 12, 2)) >= 22 && VALUE(MID(TEXT(CreatedDate), 12, 2)) < 24, "Asia", "Europe"))
)

All Answers

TechTrackerTechTracker

It might help you....

 

IF(VALUE(MID(TEXT(CreatedDate), 12, 2)) < 10, "USA",
IF( VALUE(MID(TEXT(CreatedDate), 12, 2)) >= 10 && VALUE(MID(TEXT(CreatedDate), 12, 2)) < 22, "Europe",
IF( VALUE(MID(TEXT(CreatedDate), 12, 2)) >= 22 && VALUE(MID(TEXT(CreatedDate), 12, 2)) < 24, "Asia", "Europe"))
)

This was selected as the best answer
CharlieLangCharlieLang

Thats brilliant. thanks!