## Dynamic formatting

**Question**: I have a list that I keep adding rows to. How do i create a border that expands as the list expands?

**Answer:**

The easiest way to go is an excel defined table, you can customize how it looks easily:

Recommended articles

An Excel table allows you to easily sort, filter and sum values in a data set where values are related.

Adding more rows to your list expands the border automatically. See picture below.

### How to create dynamic border

The border on top of the list is static. Here is how to create the top border:

- Select the top cells of your list
- Go to "Home" tab in excel 2007
- Press with left mouse button on the small triangle on the border button in the font window. See picture below.

- Press with left mouse button on "Top border"

### The border on the sides of the list is dynamic. Here is how to create the border on the left side:

- Select the leftmost column in your list (In this example C:C)
- Press with left mouse button on "Home" tab on the ribbon
- Press with left mouse button on "Conditional formatting"
- Press with left mouse button on "New rule..."
- Press with left mouse button on "Use a formula to determine which cells to format"
- Press with left mouse button on "Format values where this formula is true" window.
- Type =OR(C1<>"",D1<>"",E1<>"",F1<>"")
- Press with left mouse button on Format button
- Press with left mouse button on "Border tab" tab
- Create a border on left side of cell
- Press with left mouse button on OK!
- Press with left mouse button on OK!

**Here is how to create the left and bottom border on the left side:**

- Select the leftmost column in your list (In this example C:C)
- Create a new conditional formatting formula. (See above list)
- Type =AND(OR($C1<>"",$D1<>"",$E1<>"",$F1<>""),$C2="",$D2="",$E2="",$F2="")
- Create a border on the left and down side of cell

Do the same thing for the right side (F:F) of the list using the two above examples. Obviously creating borders on the right and down side of cells.

**Finally creating the border lines below the list:**

- Select the middle columns in your list (In this example D:D and E:E)
- Create a new conditional formatting formula.
- Type =AND(OR($C1<>"",$D1<>"",$E1<>"",$F1<>""),$C2="",$D2="",$E2="",$F2="")
- Create a border on the down side of cell

### Get excel sample file for this tutorial.

create-a-dynamic-border-using-excel-conditional-formatting.xls

(Excel 97-2003 Workbook *.xls)

**Functions used in this article**

**OR(**logical1, logical2, ...**)**

Checks whether any argument are TRUE and returns TRUE or FALSE. Returns FALSE only if all arguments are FALSE.

**AND(**logical1, logical2, ...**)**

Checks whether all arguments are TRUE and returns TRUE if all arguments are TRUE

### Cf misc category

Here is how to highlight every other row using conditional formatting. Conditional formatting formula: =ISEVEN(ROW())*OR($B3:$D3<>"") Alternative CF formula: =EVEN(ROW())=ROW() This […]

This article demonstrates how to apply different cell formatting to a cell range based on a Drop Down list, column […]

The picture above shows Conditional Formatting highlighting cells in cell range F3:Y22Â based on row and column values in column B […]

Pamela asks: I would like to ask you how to identify PAIR of same numbers, but with a different sign. […]

This article demonstrates a Conditional Formatting formula that lets you highlight cells based on numerical ranges specified in an Excel […]

### Conditional formatting category

The image above demonstrates a conditional formatting formula that colors a record if there is at least one record that […]

This article explains how to count cells highlighted with Conditional Formatting (CF). The image above shows data in cell range […]

adam asks: Hi, I have a situation where I want to count if this value is duplicate and if it […]

Question: How do I highlight dates that meet criteria using conditional formatting? Table of contents Highlight values in a column […]

This post demonstrates how to highlight records with the closest value to a criterion, you can also choose to highlight […]

The image above shows rows highlighted based on value in column C being the largest or smallest in that particular […]

This article shows you how to easily identify duplicate rows or records in a list. What's on this webpage Conditional […]

The image above demonstrates a conditional formatting formula applied to an Excel Table containing random data. The Excel Table has […]

Here is how to highlight every other row using conditional formatting. Conditional formatting formula: =ISEVEN(ROW())*OR($B3:$D3<>"") Alternative CF formula: =EVEN(ROW())=ROW() This […]

The image above shows you how to highlight rows with multiple criteria using OR logic. The criteria are found in […]

In this article, I will demonstrate how to search a table using conditional formatting. The criteria highlight matching column and […]

Today I am going to show you how to quickly compare two tables using Conditional Formatting (CF). I am going […]

The image above demonstrates a conditional formatting formula that highlights duplicateÂ items based on date. The first instance is not highlighted, […]

A conditional formatting formula highlights values in column B that also exist in column D. =COUNTIF($D$3:$D$7,B3) The same thing happens […]

In this post I am going to try to explain formula basics in conditional formatting. It is really good if […]

The image above shows conditional formatting highlighting unique distinct values, duplicates are not highlighted. Conditional Formatting Formula: =COUNTIF($B$3:B3, B3)=1 The […]

This article demonstrates how to apply different cell formatting to a cell range based on a Drop Down list, column […]

In this blog post I will demonstrate a conditional formatting formula that will highlight common records in two lists. The […]

The image above demonstrates a conditional formatting formula that highlights records that only exist in one table. There are two […]

## Conditional Formatting categories

## Excel categories

### 5 Responses to “Dynamic formatting”

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form

Hi! you can go here to know how to make conditional lists:

https://runakay.blogspot.com/2011/03/conditional-lists-on-excel.html

Thanks!

draw a border line automatically in a cell with fomula of anather cell

HI,

I tried your formula to do a custom border but in vain.

I have a fiscal Year period from data source which user selects number of months.. if it is for 2016 then 12 months and for 2017 2 months.

Somehow I couldn't able to follow your steps.

In your excel the data starts from C5 WHERE AS c4 IS Header.. I'm not sure why C1.

Can you please help?.

Thanks,

Jothi

Jyothi

The CF formulas are applied to whole columns. Example, column C starts with cell C1 so the CF formula must start with cell C1.