Sub topic 9
What happens when two people edit the same cell
This chapter assumes you can already save a workbook to OneDrive or SharePoint, share it, and turn on AutoSave. It builds on the previous chapters about AutoSave and real-time co-authoring. Here you will learn how Excel merges edits from several people, what "last write wins" means in practice, and which situations still produce a conflict message.
The working model: edits are merged, not locked
In a co-authored workbook, Excel does not lock the file or the sheet. Each person's copy of the workbook sends small changes to the cloud service, and the service sends the other people's changes back. A change is usually a single cell edit, a formatting change, or a structural change such as inserting a row.
Because changes are small and frequent, two people can work on the same sheet without noticing each other. Conflicts only arise when two changes touch the same thing at nearly the same time.
The behavior depends on what the two people did:
| Situation | Typical result |
|---|---|
| Two people edit different cells | Both edits are kept. No message. |
| Two people edit the same cell at different moments | The later edit replaces the earlier one. The earlier value stays in Version History. |
| Two people edit the same cell at nearly the same moment | One edit wins. The other person sees their value replaced. |
| One person edits a cell while another deletes its row | The row deletion wins. The edit goes with the deleted row. |
| One person sorts a range while another edits a cell in it | Both changes apply, but the edit may land on a different row than the editor expected. |
| A person is offline or AutoSave is off | Changes are merged or flagged when the person reconnects or saves. |
How "last write wins" works
For the same-cell case, Excel uses a last-writer-wins rule. The service applies changes in the order it receives them. If Ana types 100 into B2 and Ben types 120 into B2 a moment later, B2 ends as 120.
Ana's screen updates to show 120 once the service sends Ben's change back. Excel does not ask Ana to choose between the values. In most cases no dialog appears.
This has a practical consequence. A replaced value is not an error from Excel's point of view. If nobody notices, the earlier value is simply gone from the current file. You can still recover it from Version History or see it through Show Changes, both covered in other chapters.
Edit mode and the moment of collision
A cell is only changed once the person commits the edit by pressing Enter, Tab, or clicking another cell. While someone is typing in a cell, other people do not see the partial text. Their own copy of the cell still shows the old value.
This produces a common pattern:
- Ana starts typing in B2. Her edit is not committed.
- Ben changes B2 to 120 and commits it.
- Ana's screen receives Ben's change. Her cell is still in edit mode.
- Ana presses Enter and commits her value.
- Ana's value replaces Ben's, because hers arrived last.
Ana may never have seen Ben's value. Presence indicators help here. A colored cell border and a name flag show where other people are working. If you see someone's marker on a cell, avoid editing that cell until they move.
Formulas, references, and structural edits
Excel merges changes at the level of operations, not at the level of the final cell values. This matters for formulas.
- If Ana edits a formula in C2 and Ben edits a value that C2 refers to, both changes apply. C2 recalculates with the new input.
- If Ben inserts a row above row 5 and Ana edits cell B5 at the same time, Excel adjusts positions so that Ana's edit follows the data it was meant for. The service resolves the order of the two operations.
- If Ben deletes a column that Ana's formula refers to, the formula shows a
#REF!error. The deletion is valid, and the broken reference is the consequence.
Structural edits are the riskiest kind of change in a shared file. Inserting, deleting, sorting, and moving cells change where other people's edits land. A short message to colleagues before you restructure a sheet prevents most surprises.
Table and range behavior
Tables and sorting add some special cases.
- Sorting a range changes the position of many cells at once. If another person edits a row during the sort, their edit follows the row in many cases, but you should check the result.
- Adding a row at the bottom of a table while someone else does the same can create two new rows. Both rows are kept, in the order the service received them.
- Filters set by one person can be visible to everyone, depending on the version. Use a personal sheet view where it is available so that your filter does not change what others see.
When Excel does show a conflict message
Most overlaps resolve without a prompt. Excel shows a message when it cannot merge changes safely. This occurs mainly when:
- Your copy has been offline or disconnected with unsaved changes, and the file changed in the cloud meanwhile.
- AutoSave is off and you save a workbook that someone else has changed since you opened it.
- A feature that limits co-authoring is in use, such as a legacy Shared Workbook or certain file conditions.
In these cases Excel typically offers the following choices.
| Message or prompt | Meaning | What to do |
|---|---|---|
| "Updates available" with a Save option | Other people changed the file. Saving will merge their changes with yours. | Select Save. Excel merges and reloads. |
| "Resolve Conflicts" or a similar prompt | Excel could not merge your edits automatically. | Choose which version of the affected cells to keep. |
| "Your changes couldn't be saved" or a sync error | The connection or file state blocked saving. | Copy your recent work to a safe place, then reopen the file. |
| "Save a copy" | The file cannot be merged safely. | Save your version under a new name and compare the two. |
The exact wording changes between Excel versions and platforms, so treat the table as a guide to the type of message, not as an exact list.
Where the order is decided
The cloud service decides the order of changes. It is not decided by your local clock or by who clicked first on screen. A person with a slow connection can type first and still lose, because their change arrives later.
This is why the "who wins" outcome can seem random to the people involved. Do not design a process that depends on it. If two people must both contribute to the same value, give them separate cells and combine them with a formula.
Detecting overwritten values with a macro
You can add a small check that warns you when a cell you care about changes after you edit it. This VBA macro watches a single cell and reports its new value. It runs only in Excel for Windows or Mac with macros enabled, and the workbook must be saved as .xlsm. Co-authoring still works with macro-enabled workbooks, but macros do not run in Excel for the web.
' Place this code in the ThisWorkbook module.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sh.Name = "Budget" Then
If Not Intersect(Target, Sh.Range("B2")) Is Nothing Then
Application.EnableEvents = False
Debug.Print "B2 changed to " & Sh.Range("B2").Value & " at " & Now
Application.EnableEvents = True
End If
End If
End SubThe event fires for your own edits and, in many cases, for changes that arrive from other people. Treat it as a diagnostic aid. It is not a lock, and it does not stop another person from overwriting B2.
Practical habits that reduce collisions
- Watch the presence markers before you edit a cell that someone else seems to be using.
- Give each person a clear area: one sheet each, or one block of rows each.
- Keep inputs and calculations on separate sheets, so that people entering data do not touch formulas.
- Announce structural changes such as sorting, deleting columns, or renaming sheets.
- Leave AutoSave on, so that each change reaches the service within seconds instead of piling up.
- Use comments or @mentions to agree who updates a shared value.
- Check Version History after a busy session if a value looks wrong.
Exercises
Exercise
Ana and Ben both commit a value to cell B2 at nearly the same time. Ana's connection is slow, so her change reaches the cloud service after Ben's. Which value does B2 hold, and where could you recover the other value?
Show answer
B2 holds Ana's value, because the service keeps the change it receives last, not the one that was typed first. Ben's value can be recovered from Version History or seen through Show Changes.
Exercise
Two colleagues must each enter a monthly estimate, and the report needs the average of both. Describe a layout that avoids a same-cell collision.
Show answer
Give each person a separate input cell, for example B2 for the first person and C2 for the second. Put a formula such as =AVERAGE(B2:C2) in D2. Neither person edits the other's cell, so no estimate is overwritten.
Exercise
Ben deletes column D while Ana's formula in F2 uses D2. What does F2 show, and why does Excel not report a conflict?
Show answer
F2 shows #REF!. The deletion is a valid operation and the formula edit is not in conflict with it, so Excel merges both. The broken reference is a result of the deletion.