Skip to main content
Answer

GI Color formatting

  • February 2, 2024
  • 3 replies
  • 551 views

claudematherne24
Varsity I
Forum|alt.badge.img

I’m looking to figure out how to make my row styles based on the Days Lagging column, which is a formula that is the following:

=DateDiff('d', [SOOrder.OrderDate], Today())

 

I’d like to color code on the Days Lagging to show Red as greater than 90 days, yellow greater than 60 days, green greater than 30 days.  I’ve tried using a Switch statement that has IIf inside to do the same math, but I’m getting out of bound array issues.

 

What am I doing wrong lol?

Best answer by kyle90

I’m not an expert here but I believe =switch() won’t need an if statement, it applies the the logic in order and does nothing if your expression is not true

 

Try

=switch(

DateDiff('d', [SOOrder.OrderDate], Today())>’90’,’red20’,

DateDiff('d', [SOOrder.OrderDate], Today())>’60’,’yellow20’,

DateDiff('d', [SOOrder.OrderDate], Today())>’30’,’green20’

)

3 replies

Forum|alt.badge.img+1

Hi, can you share your Switch statement that didn’t work for you?


Forum|alt.badge.img+2
  • Captain II
  • Answer
  • February 2, 2024

I’m not an expert here but I believe =switch() won’t need an if statement, it applies the the logic in order and does nothing if your expression is not true

 

Try

=switch(

DateDiff('d', [SOOrder.OrderDate], Today())>’90’,’red20’,

DateDiff('d', [SOOrder.OrderDate], Today())>’60’,’yellow20’,

DateDiff('d', [SOOrder.OrderDate], Today())>’30’,’green20’

)


claudematherne24
Varsity I
Forum|alt.badge.img

yeah, I see the issue.  Don't know why my brain wanted to force the If there.

 

Thanks