Sub topic 12
Entering Data Across a Selected Range and with Ctrl+Enter
This chapter assumes you can already type an entry into a cell and commit it with Enter, Tab, or Esc. It also assumes you know what the active cell is and how to select a range by dragging or with Shift+click. Here you will learn how Excel moves through a selected range as you type. You will also learn how to put one entry into every cell of a selection at once.
Why select a range before typing
Normally, each Enter moves the active cell down one row, and each Tab moves it one column to the right. You can steer the cursor by hand with the arrow keys, but that costs keystrokes. If you select a range first, Excel confines the active cell to that range. You can then type values continuously and let Excel handle the movement.
Two benefits follow:
- The cursor wraps inside the selection, so you never need to reach for the mouse to start the next row or column.
- You can fill the whole selection with a single entry, which is faster and less error-prone than copying and pasting.
Moving inside a selection
When a range is selected, one cell is the active cell. It looks white, while the other selected cells are shaded. Typing always goes into the active cell.
The keys behave as follows inside a selection:
| Key | Effect |
|---|---|
| Enter | Commits the entry and moves down to the next cell in the selection. At the bottom of a column, it jumps to the top of the next column. |
| Shift+Enter | Commits the entry and moves up. |
| Tab | Commits the entry and moves right. At the end of a row, it jumps to the start of the next row. |
| Shift+Tab | Commits the entry and moves left. |
| Esc | Cancels the entry in progress. The selection stays in place. |
The selection stays highlighted while you do this. That is the main difference from ordinary entry, where pressing an arrow key would collapse the selection to a single cell.
A worked example
Suppose you want to enter quarterly figures in a block of three rows and four columns, B2:E4.
- Click B2, then drag to E4 so the block is selected.
- Type
10and press Tab. The active cell moves to C2. - Type
20, press Tab, type30, press Tab, type40, and press Tab. The active cell wraps to B3, the start of the next row inside the selection. - Continue in the same way. After E4, the active cell wraps back to B2.
By default Enter moves down. If you select B2:E4 and press Enter repeatedly, the cursor goes down column B, then column C, and so on. Choose Tab when your data runs across rows, and Enter when it runs down columns.
Changing the direction of Enter
The movement after Enter is a setting. In File > Options > Advanced, under Editing options, the check box After pressing Enter, move selection controls it. You can choose Down, Right, Up, or Left, or clear the box so the active cell stays put. This setting applies to ordinary entry too, not only to selections.
Inside a multi-cell selection, the direction you set there is also honored. If you pick Right, Enter moves along the row and Tab still moves right, so the two keys become equivalent in that case.
Changing the active cell without losing the selection
Sometimes you need to jump back to a cell in the selection without selecting something new. Clicking would destroy the selection. These keys keep it:
- Enter, Tab, and their Shift versions cycle through the selection, as described above.
- Ctrl+. (period) moves the active cell clockwise between the four corners of the selection. This helps you check the extent of a large block.
- Ctrl+Backspace scrolls the view back to the active cell if you have scrolled away from it.
Pressing an arrow key or clicking a cell outside the selection cancels the selection. If that happens, you have to select the range again.
Filling the whole selection with Ctrl+Enter
Ctrl+Enter commits the entry and writes it into every cell of the selection, not just the active cell. This works for text, numbers, dates, and formulas.
Steps
- Select the range, for example D2:D20. The cells do not need to be adjacent.
- Type the entry. Do not press Enter yet.
- Press Ctrl+Enter.
Every selected cell now holds the same entry. The active cell stays where it was, so you can keep working.
Using it with formulas
Ctrl+Enter is most useful with formulas, because relative references adjust for each cell, as they do when you copy a formula. Suppose the quantities are in A2:A20 and the prices are in B2:B20.
- Select C2:C20.
- Type the formula below. The active cell is C2, so the formula is written from the point of view of C2.
- Press Ctrl+Enter.
=A2*B2Cell C3 now holds =A3*B3, C4 holds =A4*B4, and so on. You have entered 19 formulas with one keystroke combination.
Note that no autofill step is involved. The result is the same as typing the formula in C2 and copying it down, but Ctrl+Enter does not use the clipboard and does not copy formatting from C2.
Using it with non-adjacent cells
Hold Ctrl while you click or drag to build a selection from several separate blocks. For example, select A2:A5, then hold Ctrl and select C2:C5 and E2:E5. Type Pending and press Ctrl+Enter. All twelve cells receive the text. This is a quick way to set a status or default in scattered places.
With a non-adjacent selection, Enter and Tab still work. They move through the blocks in the order you selected them, and then wrap.
Typing a value into many cells with a different pattern
Ctrl+Enter writes an identical entry. If you need each cell to get a different value, use Tab or Enter inside the selection instead, or use the fill handle covered in a later chapter. Choose by this rule:
- Same entry everywhere: Ctrl+Enter.
- A different value in each cell, typed by hand: select the range, then use Tab or Enter.
- A series or pattern: use the fill handle or Flash Fill.
Edge cases and common errors
Overwriting existing data
Ctrl+Enter replaces whatever is in the selected cells with no confirmation. If some cells already hold data, it is lost, although Undo (Ctrl+Z) restores it. Check the selection before you commit. The Name Box shows the size of the selection while you drag it, and the status bar shows a count if you select cells holding data.
Protected and locked cells
If a sheet is protected, Excel refuses an entry that includes locked cells, and it shows an error message. The entry is not written to the unlocked cells either. Select only unlocked cells, or unprotect the sheet.
Merged cells
Ctrl+Enter does not work well when a selection includes merged cells of a different shape from the rest. Excel may show a message that the operation requires merged cells to be identically sized. Avoid merged cells in data areas.
Leading zeros and other interpretation rules
Ctrl+Enter follows the same interpretation rules as ordinary entry. If you type 00123 and press Ctrl+Enter, every cell receives the number 123. To keep the zeros, either format the range as Text before typing or begin the entry with an apostrophe:
'00123The apostrophe makes Excel store the entry as text, and it does not appear in the cell. The same applies to dates: typing 3/4 into a selection and pressing Ctrl+Enter stores a date in every cell.
Filtered and hidden rows
If rows are hidden by a filter, a selected range spans them, and Ctrl+Enter writes into the hidden rows as well. This surprises many users who expect only the visible cells to change. To affect only visible cells, select the range, press Alt+; to select visible cells only, and then enter your data.
Editing mode versus Enter mode
Ctrl+Enter only fills the selection when you commit a new entry. If you press F2 to edit an existing cell and then press Ctrl+Enter, Excel still commits the edit and fills it into all selected cells. This is useful, but it can overwrite cells you did not intend to change. Check the selection first.
Summary of the technique
- Select the range first, then type. Excel keeps the active cell inside the selection.
- Use Tab and Enter to move in the selection, and Shift to move backward.
- Use Ctrl+Enter to put one entry into every selected cell.
- Relative references in a formula adjust for each cell.
- Interpretation rules, locking, filters, and merged cells still apply.
Exercise
You select C2:C50, but rows 10 to 20 are hidden by a filter. You type 0 and press Ctrl+Enter. Are the hidden rows changed? How would you change only the visible rows?
Show answer
Yes, the hidden rows receive 0 as well, because the selection includes them. To change only the visible rows, select C2:C50, press Alt+; to select visible cells only, type 0, and press Ctrl+Enter.
Exercise
Quantities are in A2:A30 and unit prices are in B2:B30. Describe how to fill C2:C30 with the line totals using one entry, and say what C7 contains afterward.
Show answer
Select C2:C30, type =A2B2 with C2 as the active cell, and press Ctrl+Enter. Cell C7 contains =A7B7, because the relative references adjust for each cell.
Exercise
You select B2:E4 and type values with Tab. After you type the value in E2 and press Tab, which cell becomes active?
Show answer
B3. Tab wraps from the end of a row to the start of the next row inside the selection.