Author: Oscar Cronquist Article last updated on March 09, 2021

Companion planting

I found a chart that I wanted to show you how to build. It contains values both horizontally and vertically, the intersecting cells are colored based on conditions.

The printable planting guide is found here. This is what the color means:
Light green : Plants grow well together.
Red : Don't plant together.
Dark green : The combination helps bug control.
Yellow : Carrots will have good flavor but stunted roots.
Grey : Beneficial to the garden in general.

Start typing the plant names in cell A2 and continue with cells below.
Building a companion planting chart 1

Back to top

1. How to transpose values vertically to horizontally?

transpose values2

The animated image above shows a smaller set of values being transposed.

  1. Select cells in cell range A2:A31.
  2. Copy cells.
  3. Select the destination cell.
  4. Press with left mouse button on the "Paste" button. A pop-up menu appears.
  5. Press with left mouse button on the "Transpose" button.

Back to top

2. How to orient cell values vertically?

How to build a comparison chart

The image above shows cell values in B1:D1 aligned vertically.

  1. Select cell range B1:AE1.
  2. Press with right mouse button on on cell range B1:AE1. A pop-up menu appears.
  3. Press with left mouse button on "Format Cells..." on the pop-up menu. A dialog box shows up, see image below.
    Building a companion planting chart 3
  4. Go to tab "Alignment".
  5. Change "Orientation" to 90 degrees, see image above.
  6. Press with left mouse button on OK button to apply settings..

Back to top

3. How to change column width for multiple columns simultaneously?

adjust column width automatically 1

The animated image above shows how to change column width by dragging the column border with the mouse.

  1. Select columns B:AE.
  2. Press and hold with left mouse button on any column border.
  3. Drag with mouse until column width is around 20 pixels,
  4. Release the left mouse button.

Tip!

adjust column width automatically

  1. Select columns B:AE.
  2. Doublepress with left mouse button on with left mouse button on any column border in B:AE.
    This adjusts the column width to the text.

Back to top

4. How to apply cell background color using conditional formatting?

Building a companion planting chart 5

The image above shows the cell grid populated with numbers, we are going to color the cell background using Conditional Formatting based on these numbers.

  1. Type 1 for green, 2 for red, 3 for grey, 4 for dark green and 5 for yellow in cell range B2:AE31.
  2. Select cell range B2:AE31 and go to tab "Home" on the ribbon.
  3. Press with left mouse button on "Conditional formatting" button.
  4. Press with left mouse button on "New Rule..".
  5. Select "Use a formula to determine which cells to format", see image below.
  6. Type =B2=1
    Building a companion planting chart 6
  7. Press with left mouse button on "Format..." button.
  8. Go to tab "Fill".
  9. Pick a color.
  10. Press with left mouse button on OK button twice.

Repeat above steps for cell values 2, 3, 4, and 5 but the formulas become =B2=2, =B2=3 , B2=4 and B2=5 and pick different fill colors.

Building a companion planting chart 7

Back to top

4.1 Explaining conditional formatting formula

Conditional formatting formula:

=B2=1

Step 1 - Relative cell reference

B2 is a relative cell reference, it changes when the CF formula moves to the next cell. For example, the CF formula moves to cell B3 and the relative cell reference then changes to B3.

This evaluates the contents of each cell and colors the corresponding cell background based on the its cell value.

Step 2 - Cell value is equal to 1

The equal sign compares the contents of cell B2 to 1.

B2=1

becomes

""=1

and returns FALSE.

Step 3 - Evaluate TRUE and FALSE

If the logical expression returns TRUE the cell background changes to green. If FALSE then nothing happens.

Back to top

5. How to hide cell values using cell formatting?

Building a companion planting chart 9

The image above shows the cell grid without the numbers only cell background colors. The numbers are still there, however, you can't see them. Select a cell and the number shows up in the Formula bar.

Here is how to hide the numbers in cell range B2:AE31.

  1. Select B2:AE31.
  2. Press CTRL + 1. A dialog box appears.
  3. Press with left mouse button on "Custom" category, see image below.
  4. Type ;;;
  5. Press with left mouse button on OK button to dismiss the dialog box and apply settings..
    Building a companion planting chart 8

6. How to create cell borders?

How to build a comparison chart create cell borders

The image above shows cell range A1:AE31 selected. Here is how to insert borders to cell range A1:AE31:

  1. Select A1:AE31.
  2. Go to the "Home" tab on the ribbon.
  3. Press with left mouse button on "Borders". A pop-up menu shows up.
    How to build a comparison chart all borders
  4. Select "All Borders".

How to build a comparison chart all borders1

You could color each cell manually, but in my opinion, building this chart is a lot easier using cell numbers.

Back to top

Articles on the same subject

Heat map using pictures | Use a map in an excel chart | Shift Schedule | Dynamic Gantt charts in excel 2007 | Dynamic chart – Display values from a table row or column

Get the Excel file


Companion-planting-chart.xlsx

Back to top