# Google Docs reference to specific number of numbered list

I am creating a long list with many (>50) references to previous list numbers in Google Docs. Here is a simplified example:

1. Do A
2. Go to B
3. Wash C
4. Pick up D
5. Clean E
6. Repeat Step 2

If I delete "1. Do A" the list renumbers, but "Repeat Step 2" does not change to "Repeat Step 1". Is there a way to create a reference or variable in Google Docs to automatically change "6. Repeat Step 2" to "5. Repeat Step 1" when the first step is deleted?

Using the new Reversible Formulas add-on for Google Docs, you can enter any JavaScript in your Google docs. And since it is evaluated in order, you can use counters.

Write the following:

``````counter = (0)
labels = ({})
step = (function(name) {  counter++; labels[name || ""] = counter; return counter; })
ref = (function(name) { return labels[name]; })

=step(). Do A
=step("b"). Go to B
=step(). Wash C
=step(). Pick up D
=step(). Clean E
=step(). Repeat Step =ref("b")
``````

Click on "Display values". You'll obtain this:

Delete the first "1. Do A". Click on "Display values" again. You'll obtain this:

You can hide the initial definitions by clicking on "Extract defs" - this will place the definitions in the right box.

Disclaimer: I'm the author of the add-on

Off the top of my head, no, there is no way to do this in a Google Doc file. But if you are managing a sequence of tasks, and want to update them dynamically, why not do this using a Google Sheet? That way you can reference the number of the step and keep it up to date!

This way, if you needed to change the sequence of steps you could simply add or delete a row and copy the formula in the Step # column down. It's not perfect but it is flexible.

Making references to specific steps is easy, the code for the description in step 6 is as follows:

`="Repeat step "&A\$3\$`

Hope that helps. Google Docs is not the right place to try and do this sort of thing.

Your best bet is to manage this list in Google Sheets where you can use native, simple, formulas to reference position in the list and values without relying on external plugin's or extensions.

The "Smart References" Add-On for Google Docs can be used to create cross references to numbered list bullets, including references that are placed inside list items. The plugin requires a manual "sync" step, similar to how a ToC works - but it's designed to be easier to use than a scripting or spreadsheet based solution.

I wrote and published this add-on after having a similar problem with cross referencing legal clause numbers in long contract templates.