Skip to Content
Author's profile photo Rahul Handa

Macro – Set Background Color of a Cell

In certain cases we want to give visibility to users while interactive planning. This could be comparing different key figures, could be value for key figures (example >5000) etc. If the value exceeds then user needs to see the same in real time. This could be achieved by setting the background color of a cell to different color.

For this we will define a macro using CELL_BG function. In the below example we are comparing one key figure to another and if value is greater then other KF the cell of that key figure will turn “RED”. Define the macro as default macro.

Macro 1.JPG

Let’s see the effect of macro. As we can see; when the value in composite forecast is greater then production forecast the color of that specific cell changes to “RED”.

Macro 1.JPG

For different colors here are the values which you can maintain in macro:

Black if X = 0

Blue if X = 1

White if X = 2

Yellow if X = 3

Cyan if X = 4

Green if X = 5

Red if X = 6

Magenta if X = 7

Deep blue if X = 8

Gray if X = 9

Bright yellow if X = 10

Intensive cyan if X = 11

Intensive green if X = 12

Deep red if X = 13

Deep magenta if X = 14

Also check Macro – Set Foreground Color of a Cell

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Christopher Smith
      Christopher Smith

      Another good post, thanks for the examples!

      Author's profile photo Rahul Handa
      Rahul Handa
      Blog Post Author

      Thanks Christopher

      Author's profile photo Péter Wilhelm
      Péter Wilhelm

      If I use this macro template a I am getting the value in the cell which I have used for the color like 6 (red)

      Do you have any update on this topic? Should I use an another operator?

      Thank you.