Formatting cells

Fonts, colours, borders, alignment, wrap, merging, number formats and custom format codes, cell styles, and every option in the Format Cells dialog.

Formatting changes how cells look without changing what they hold. Every command on this page acts on the whole selection. For formatting that changes with the values, see Conditional formatting; for colours and fonts that apply to the whole workbook, see Themes and backgrounds.

Font

The Font group on the Home tab has:

ControlWhat it does
FontChoose Calibri, Hanken Grotesk, Arial, Helvetica, Times New Roman, Georgia, Courier New, JetBrains Mono or Verdana. A cell with no font set shows Calibri.
Font sizeChoose 8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 36 or 48 points. A cell with no size set shows 11.
Increase font size / Decrease font sizeChange the size by one point, between 1 and 409
Bold⌘B (Ctrl+B on Windows and Linux)
Italic⌘I (Ctrl+I)
Underline⌘U (Ctrl+U)
Double underline (U̲U̲)The accounting underline for a total. Pressing it on singly underlined text switches it to double.
Text colourChoose from 18 colours, or No colour to go back to the default
Fill colourChoose from 18 colours, or No colour to remove the fill

Bold, italic and the underlines are toggles. When every selected cell already has the style, pressing the button turns it off; otherwise it turns it on for all of them.

Borders

Open Home › Font › Borders and choose an arrangement. Borders apply to the selection as a block: Outline draws one box round the whole selection, not a box round each cell.

Menu itemWhat it draws
All bordersThin lines round every cell
OutlineA thin box round the selection
Thick outlineA thick box round the selection
Top, Bottom, Left, RightA thin line along that edge of the selection
Top and bottomThin lines along the top and bottom edges
Double bottomA double line along the bottom edge
No bordersRemoves the borders
More borders…Opens Format cells at the Border tab

Alignment

The Alignment group on the Home tab has:

ControlWhat it does
Top align, Middle align, Bottom alignVertical position of the text in the cell
AngleHorizontal, Angle up 45°, Angle down 45°, Vertical up 90°, Vertical down 90°
Decrease indent / Increase indentMoves the text in from the left, one step at a time, up to 15 steps
Align left, Centre, Align rightHorizontal position of the text. With none chosen, numbers sit on the right and text on the left.
Wrap textBreaks long text onto several lines inside the cell’s width
Merge (Merge the selected cells)Merges the selection into one cell, or unmerges it
Merge acrossMerges each row of the selection separately
DirectionContext, Left to right or Right to left

Wrap text

After turning on Wrap text, choose Home › Cells › Format › AutoFit row height to fit the row to the wrapped text, or drag the row’s bottom edge.

Merge cells

  1. Select the cells.
  2. Click the merge button in Home › Alignment.

Only the top-left cell’s contents are kept. The other cells in the block are cleared. Merging does not centre the text; use Centre as well if you want that.

To unmerge, select the merged cell and click the merge button again. Selecting a block that overlaps merged cells and clicking the button unmerges them.

Merge across merges each row of the selection into one wide cell — for example, five headings each four columns wide rather than one tall cell. It needs a selection at least two columns wide; otherwise the status bar says Select at least two columns to merge across.

Number formats

A number format controls how a value is displayed. The value itself is unchanged: 0.25 formatted as a percentage shows 25.00% and is still 0.25 in formulas.

Number format list

Choose a format from the number format list in Home › Number:

FormatCodeExample of 1234.5
GeneralGeneral1234.5
Number#,##0.001,234.50
Currency$#,##0.00$1,234.50
Accounting_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)$ 1,234.50
Percent0.00%123450.00%
Scientific0.00E+001.23E+03
Short dateyyyy-mm-dd1903-05-18
Long datedddd, d mmmm yyyyMonday, 18 May 1903
Timeh:mm:ss12:00:00
Date & timeyyyy-mm-dd h:mm1903-05-18 12:00
Fraction# ?/?1234 1/2
Text@See the note below

When a cell has a format that is not in the list, the list shows Custom. To set a custom format, use Format cells….

Dates and times are numbers: whole days counted from 1 January 1900, with the time as a fraction of a day. The example dates above show 1234.5 read as a date.

Other number buttons

ControlWhat it does
Currency menu£ pound, $ dollar and € euro apply a symbol with two decimals and thousands separators, such as "£"#,##0.00. £ accounting and $ accounting apply an accounting format, which keeps the symbol apart from the number.
PercentApplies 0.00%
Comma (,)Comma style: #,##0.00
Add a decimal place / Remove a decimal placeShows one more or one fewer decimal place, up to 12. A General cell becomes 0.0 or 0. For a format with several sections, only the first section changes.
Format cells…Opens the Format cells dialog at its Number tab

Custom format codes

A format code can have up to four sections separated by semicolons: positive numbers; negative numbers; zero; text. For example, #,##0.00;[Red]-#,##0.00;"–";@ shows 1234.5 as 1,234.50, −1234.5 as a red -1,234.50, and zero as –. With two sections, the second is for negative numbers and zero uses the first.

CodeMeaning
0A digit, shown even when it is zero
#A digit, left out when it isn’t needed
?A digit placeholder, used mostly in fractions
.The decimal point
,The thousands separator
%Multiplies by 100 and shows a percent sign
E+00Scientific notation
# ?/?, # ??/??A fraction
"text"Shows the text in quotes
\xShows the single character after the backslash
_xLeaves a space the width of a character, to line things up
*xA fill character
@In the text section: the cell’s text
[Black], [Blue], [Cyan], [Green], [Magenta], [Red], [White], [Yellow]Colours the section
yy, yyyyYear
m, mm, mmm, mmmm, mmmmmMonth as 1, 01, Jan, January or J
d, dd, ddd, ddddDay as 1, 01, Mon or Monday
h, hhHour
m, mm after h or before sMinutes
s, ssSeconds
AM/PM, A/P12-hour clock
[h], [m], [s]Elapsed hours, minutes or seconds, beyond 24 hours or 60 minutes

Cell styles

Open Home › Styles › Cell styles and choose a named look:

StyleWhat it sets
NormalRemoves all formatting except the number format
GoodDark green text on a light green fill
BadDark red text on a light red fill
NeutralDark yellow text on a light yellow fill
Title18-point bold, blue-grey
Heading 115-point bold, blue-grey
Heading 213-point bold, blue-grey
Heading 311-point bold, blue-grey
TotalBold, with a thin line above and a double line below
InputDark blue text on a light orange fill
CalculationBold orange text on a light grey fill
NoteA pale yellow fill

A style replaces the cells’ other formatting — font, colours, borders and alignment — and keeps their number format. It is applied as ordinary formatting, so cells don’t stay linked to the style.

The Format Cells dialog

The Format cells dialog holds every formatting option in one place. Open it with Home › Number › Format cells…, or with Borders › More borders…, which opens it at the Border tab.

The dialog’s title shows the address of the selection, such as Format cells — B2:D9. It starts from the current cell’s formatting. Switch between the tabs with the buttons along the top: Number, Alignment, Font, Border, Fill and Protection.

Click Apply to apply everything you set, on every tab, as one undo step. Click Cancel to close without changing anything.

Number tab

OptionWhat it does
CATEGORYThe formats from the number format list: General, Number, Currency, Accounting, Percent, Scientific, Short date, Long date, Time, Date & time, Fraction, Text
CUSTOM — Format codeType any format code, for example #,##0.00;[Red]-#,##0.00. It replaces the category as you type.
PREVIEWThe number −1234.5 shown in the chosen format

Alignment tab

OptionChoices
HORIZONTALGeneral, Left, Centre, Right, Fill, Justify, Across selection
VERTICALTop, Middle, Bottom, Justify
TEXT CONTROLWrap text
IndentA whole number from 0 to 15
Rotation, degreesA whole number from −90 to 90
TEXT DIRECTIONContext, Left to right, Right to left. Context works out the direction from the characters in the cell.

Font tab

OptionChoices
STYLEBold, Italic, Strikethrough
UNDERLINENone, Single, Double
COLOURNo colour, or one of ten colours

To change the font name or size, use the Font group on the ribbon.

Border tab

The Border tab works like a pen: choose a line and a colour, then click the edges to draw it on.

  1. Under LINE, choose None, Thin, Medium, Thick, Dashed, Dotted or Double.
  2. Under LINE COLOUR, choose a colour, or the crossed box for the default.
  3. Under EDGES, click the edges to draw: Top, Bottom, Left, Right, Diagonal ↘ and Diagonal ↗. When the selection is more than one row tall, Across draws the lines between the rows; when it is more than one column wide, Down draws the lines between the columns.

Clicking an edge that already has exactly that line removes it. The preview box beside the edge buttons shows the result. The pen starts as the first line already drawn on the selection, so your first click on an existing edge takes it off.

The PRESETS buttons set several edges at once:

PresetWhat it does
NoneRemoves the outer edges and the lines between cells
OutlineDraws the four outer edges with the pen
InsideDraws the lines between cells with the pen (shown only for a block of more than one cell)

Edges belong to the block: Top is the top of the whole selection, not of each cell. The two diagonals are drawn corner to corner in every selected cell; if you set both with different lines, both use the Diagonal ↘ line.

Fill tab

BACKGROUND — no fill, or one of ten colours.

Protection tab

PROTECTION — Locked. Locked cells can’t be typed into once the sheet is protected. Every cell starts locked, so protecting a sheet without unlocking anything locks all of it. See Protecting sheets and workbooks.

Copy formatting

  • Use the format painter in Home › Clipboard to copy formatting from one cell to others.
  • Use Paste › Formatting only to paste only the formatting of copied cells.
  • Use Fill › Across worksheets — formats only to copy formatting to the same cells on every other sheet.

See Entering and editing data.

Remove formatting

Select the cells and choose Home › Editing › Clear › Clear formats. The values stay.

Something unclear or out of date on this page? Tell us.