Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to do conditionally format background color of a field on a straight table

Hello experts

How should apply conditionally format the background color of a field Name is C on a straight table. The first condition is working fine without any problem . if i do same reaming conditions it's not working.

=if(DID='DD1' and num(C)>B,Red(),if(DID='DD1' and C<B, Green(),White()))

=if(DID='DD2' and num(C)>B,Red(),if(DID='DD2' and C<B, Green(),White()))

=if(DID='DD3' and num(C)>B,Red(),if(DID='DD3' and C<B, Green(),White()))

=if(DID='DD4' and num(C)>B,Red(),if(DID='DD4' and C<B, Green(),White()))

Please see the sample attachment.

Thanks

sharma

1 Solution

Accepted Solutions
akash3191
Partner - Contributor III
Partner - Contributor III

Hi Rajendra,

For your condition to work properly, there should be only numeric values in "B" column. In your example the column also contains string which is causing the issue.

What you can do is, create two columns (One defining the threshold value and other representing the unit of that threshold value, only if its necessary). Then you can compare your "C" column values to the Threshold values.

I've used below condition.

=if(DID='DD1' and C>Threshold,LightRed(),

    if(DID='DD1' and C<Threshold, Green(),

        if(DID='DD2' and C>Threshold,LightRed(),

            if(DID='DD2' and C<Threshold, Green(),

                if(DID='DD3' and C>Threshold,LightRed(),

                    if(DID='DD3' and C<Threshold, Green(),

                        if(DID='DD4' and C>Threshold,LightRed(),

                            if(DID='DD4' and C<Threshold, Green(),White()))))))))

Attached is the application representing the same.

Hope this helps.

Thanks,

Akash.

View solution in original post

7 Replies
sunny_talwar

Is this your goal?

Capture.PNG

Try this if the above is what you wanted

=If(C > B, LightRed(), If(C < B, Green(), White()))

Not applicable
Author

Hi Sunny,

Thanks for your quick reply, That is not my goal, I need to calculate based on DID categories. The above conditions are Simplify for better understanding.

Do you have any idea how to do it in single column multiple if conditions.

Thanks

Sharma

akash3191
Partner - Contributor III
Partner - Contributor III

Hi Rajendra,

For your condition to work properly, there should be only numeric values in "B" column. In your example the column also contains string which is causing the issue.

What you can do is, create two columns (One defining the threshold value and other representing the unit of that threshold value, only if its necessary). Then you can compare your "C" column values to the Threshold values.

I've used below condition.

=if(DID='DD1' and C>Threshold,LightRed(),

    if(DID='DD1' and C<Threshold, Green(),

        if(DID='DD2' and C>Threshold,LightRed(),

            if(DID='DD2' and C<Threshold, Green(),

                if(DID='DD3' and C>Threshold,LightRed(),

                    if(DID='DD3' and C<Threshold, Green(),

                        if(DID='DD4' and C>Threshold,LightRed(),

                            if(DID='DD4' and C<Threshold, Green(),White()))))))))

Attached is the application representing the same.

Hope this helps.

Thanks,

Akash.

Anil_Babu_Samineni

Here, The problem is B Values which has <30 and <10 . Try to convert those into simple values and see. Your expression seems ok to me

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Could you please provide few more details on the issue you are facing?

As per my understanding, you are not able to set background color to the expressions in straight table and it worked for the 1st expression alone not for other cells.

Based on my understanding I tried to use the same expression you used in the background color expression of C to all other expressions and the cell color is changing accordingly.

table.PNG

Regards,

Leni Balakrishnan

sunny_talwar

I guess I am not sure what you are looking for, but you have got more responses, may be one of those can help out here

Not applicable
Author

Hi Akash Shah,

Thanks for your very much.

Thanks

sharma