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:
| Control | What it does |
|---|---|
| Font | Choose Calibri, Hanken Grotesk, Arial, Helvetica, Times New Roman, Georgia, Courier New, JetBrains Mono or Verdana. A cell with no font set shows Calibri. |
| Font size | Choose 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 size | Change 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 colour | Choose from 18 colours, or No colour to go back to the default |
| Fill colour | Choose 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 item | What it draws |
|---|---|
| All borders | Thin lines round every cell |
| Outline | A thin box round the selection |
| Thick outline | A thick box round the selection |
| Top, Bottom, Left, Right | A thin line along that edge of the selection |
| Top and bottom | Thin lines along the top and bottom edges |
| Double bottom | A double line along the bottom edge |
| No borders | Removes the borders |
| More borders… | Opens Format cells at the Border tab |
Alignment
The Alignment group on the Home tab has:
| Control | What it does |
|---|---|
| Top align, Middle align, Bottom align | Vertical position of the text in the cell |
| Angle | Horizontal, Angle up 45°, Angle down 45°, Vertical up 90°, Vertical down 90° |
| Decrease indent / Increase indent | Moves the text in from the left, one step at a time, up to 15 steps |
| Align left, Centre, Align right | Horizontal position of the text. With none chosen, numbers sit on the right and text on the left. |
| Wrap text | Breaks 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 across | Merges each row of the selection separately |
| Direction | Context, 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
- Select the cells.
- 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:
| Format | Code | Example of 1234.5 |
|---|---|---|
| General | General | 1234.5 |
| Number | #,##0.00 | 1,234.50 |
| Currency | $#,##0.00 | $1,234.50 |
| Accounting | _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_) | $ 1,234.50 |
| Percent | 0.00% | 123450.00% |
| Scientific | 0.00E+00 | 1.23E+03 |
| Short date | yyyy-mm-dd | 1903-05-18 |
| Long date | dddd, d mmmm yyyy | Monday, 18 May 1903 |
| Time | h:mm:ss | 12:00:00 |
| Date & time | yyyy-mm-dd h:mm | 1903-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
| Control | What 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. |
| Percent | Applies 0.00% |
| Comma (,) | Comma style: #,##0.00 |
| Add a decimal place / Remove a decimal place | Shows 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.
| Code | Meaning |
|---|---|
0 | A 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+00 | Scientific notation |
# ?/?, # ??/?? | A fraction |
"text" | Shows the text in quotes |
\x | Shows the single character after the backslash |
_x | Leaves a space the width of a character, to line things up |
*x | A fill character |
@ | In the text section: the cell’s text |
[Black], [Blue], [Cyan], [Green], [Magenta], [Red], [White], [Yellow] | Colours the section |
yy, yyyy | Year |
m, mm, mmm, mmmm, mmmmm | Month as 1, 01, Jan, January or J |
d, dd, ddd, dddd | Day as 1, 01, Mon or Monday |
h, hh | Hour |
m, mm after h or before s | Minutes |
s, ss | Seconds |
AM/PM, A/P | 12-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:
| Style | What it sets |
|---|---|
| Normal | Removes all formatting except the number format |
| Good | Dark green text on a light green fill |
| Bad | Dark red text on a light red fill |
| Neutral | Dark yellow text on a light yellow fill |
| Title | 18-point bold, blue-grey |
| Heading 1 | 15-point bold, blue-grey |
| Heading 2 | 13-point bold, blue-grey |
| Heading 3 | 11-point bold, blue-grey |
| Total | Bold, with a thin line above and a double line below |
| Input | Dark blue text on a light orange fill |
| Calculation | Bold orange text on a light grey fill |
| Note | A 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
| Option | What it does |
|---|---|
| CATEGORY | The formats from the number format list: General, Number, Currency, Accounting, Percent, Scientific, Short date, Long date, Time, Date & time, Fraction, Text |
| CUSTOM — Format code | Type any format code, for example #,##0.00;[Red]-#,##0.00. It replaces the category as you type. |
| PREVIEW | The number −1234.5 shown in the chosen format |
Alignment tab
| Option | Choices |
|---|---|
| HORIZONTAL | General, Left, Centre, Right, Fill, Justify, Across selection |
| VERTICAL | Top, Middle, Bottom, Justify |
| TEXT CONTROL | Wrap text |
| Indent | A whole number from 0 to 15 |
| Rotation, degrees | A whole number from −90 to 90 |
| TEXT DIRECTION | Context, Left to right, Right to left. Context works out the direction from the characters in the cell. |
Font tab
| Option | Choices |
|---|---|
| STYLE | Bold, Italic, Strikethrough |
| UNDERLINE | None, Single, Double |
| COLOUR | No 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.
- Under LINE, choose None, Thin, Medium, Thick, Dashed, Dotted or Double.
- Under LINE COLOUR, choose a colour, or the crossed box for the default.
- 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:
| Preset | What it does |
|---|---|
| None | Removes the outer edges and the lines between cells |
| Outline | Draws the four outer edges with the pen |
| Inside | Draws 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.