Forum Discussion

Jack15975's avatar
Jack15975
Copper Contributor
Apr 05, 2023

Changing cell layouts based on a formula

Hi All,

 

I am having difficulty with this issue. I want my excel diagram to change depending on the parameters I have in my cell. For example, in the first image, my cell is "8x12" and shows the correct grid. If I make this cell a dropdown list and have additional grids ("4x6" for example), how can I make that change to the correct grid?

 

 

Thanks

1 Reply

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    Jack15975 

    As far as I could understand the problem...
    You can use conditional formatting to change the layout of cells based on a formula. Here's an example of how you might do this:

    Select the cells you want to format.
    On the Home tab, click the Conditional Formatting button and choose New Rule.
    In the New Formatting Rule dialog box, select Use a formula to determine which cells to format.
    In the formula box, enter a formula that returns TRUE for the cells you want to format. For example, if you want to format cells in the range A1:L8 when the value in cell A1 is "8x12", you can use the following formula: =AND(ROW()<=8,COLUMN()<=12, $A$1 ="8x12")
    Click the Format button and choose the formatting options you want to apply.
    Click OK to close the Format Cells dialog box, and then click OK again to close the New Formatting Rule dialog box.
    Now if you change the value in cell A1 to "8x12", the cells in the range A1:L8 will be formatted according to the formatting options you specified.

     

    You can use a similar approach to create additional conditional formatting rules for other grid sizes. Just make sure to adjust the formula and formatting options accordingly.

Resources