9

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
  7. Buy F

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?

1

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")
=step(). Buy F

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

rendered content 1

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

rendered content 2

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

URL of the add-on: https://chrome.google.com/webstore/detail/formulas-for-google-docs/kgjbgmonlnhglokmfnpnklegakfknbeh

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

0

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!

Task list in Excel

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.