# How to increment variable instead of result

We all know that if we put the number `1` into cell A1 and then put `=A1+1` into cell A2 that it will calculate and display the number `2`, and so on.

I have a different situation now and want to increment the variable instead of the calculated result. For example, if cell A2 has `=A1+1` then I want cell A3 to have `=B1+1`, A4 to have `=C1+1` and so on. I feel like there must be a way but couldn’t track anything down, maybe not describing it right.

In my particular situation, the first cell has a formula like:
`=J4 & "--" & L2` and the next cell should be
`=J4 & "--" & M2`, increasing the letter of the second variable.
After 12 cells… the formula will be
`=J5 & "--" & L2` and then
`=J5 & "--" & M2` and so on.

Just figuring out how to quickly copy/paste the set of 11 or 12 cells would be immensely helpful, and then I can manually input the 13th cell and quickly paste 11 more cells, and so on.
Thanks!

Hallo

``````=TEXTJOIN("--";1;A1:Z1)
``````

or start somewhere with:

``````=TEXTJOIN("--";1;A\$1:INDEX(\$1:\$1;ROW(A2)))
``````

and pull down

1 Like

Wow thank you!  Never would have come up with that in a million years.
I have a bit more experience with bash script and just came up with this too:
`for i in {L..W}; do echo '=J4 & "--" & '"\${i}"'2'; done`
then just copy/paste

Looks like youre really after itertools — Functions creating iterators for efficient looping — Python 3.11.2 documentation