Formula to return sequence (e.g.: AA + 1 = AB; AZ + 6 = BF)

enoctis

New Member
Joined
Aug 19, 2021
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
Although this is similar to other resolved posts, I was unable to find one that matches my specific need.

As the title states, I need to be able to specify a starting string, and increase the sequence by a specified number. For example:

If starting string is AA and
The number to increase by is 5 then
The result should be AF

Using the example above, the desired formula accepts the starting string and the "increase by" number to result in the new AA notation.

CG plus 26 should return DG.

Preferably, the formula would do the same for triple-character notation. Meaning BZZ plus 3 would hopefully return CAC.

Any assistance is immensely appreciated. Although I could get this to work, I'm certain that my formula would be incredibly cumbersome and very resource hungry. Thank you guys, in advance, for your help!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
How about this?

ExpandIP.xlsm
A
1AF
2DG
Sheet10
Cell Formulas
RangeFormula
A1A1=xl("AA",5)
A2A2=xl("CG",26)


VBA Code:
Function XL(s As String, n As Long)
XL = Split(Range(s & "1").Offset(, n).Address, "$")(1)
End Function
 
Upvote 0
Or a non-VBA solution.

ExpandIP.xlsm
CDEF
1AA5AF
2CG26DG
3BZZ3CAC
Sheet10
Cell Formulas
RangeFormula
F1:F3F1=SUBSTITUTE(LEFT(CELL("address",OFFSET(INDIRECT(C1&"1"),,D1)),SEARCH("$",CELL("address",OFFSET(INDIRECT(C1&"1"),,D1)),2)-1),"$","")
 
Upvote 0
Solution
this is a fun problem! a good example of modular

A1Enter data:ABC
A2Formula=IF(LEN(A1)>=3,LEFT(RIGHT(A1,3)),"")
A3Formula=FIND(A2,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
A4Formula=ROUNDDOWN(B4/26,0)
A5Formula=A4+A3
A6Formula=CHOOSE(A5,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
B1Enter data:
5​
B2Formula=IF(LEN(A1)>=2,LEFT(RIGHT(A1,2)),"")
B3Formula=FIND(B2,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
B4Formula=ROUNDDOWN(C4/26,0)
B5Formula=B4+B3
B6Formula=CHOOSE(B5,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
C2Formula=IF(LEN(A1)>=2,LEFT(RIGHT(A1,2)),"")
C3Formula=FIND(C2,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
C4Formula=C3+B1
C5Formula=MOD(C4,26)
C6Formula=CHOOSE(C5,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
 
Last edited:
Upvote 0
I do like coding, a LOT. However, the computers I need to use this on are in a secure area, on a secure network. Therefore, all macros are disabled. I really appreciate the effort, but I can't use your code. Cheers!
 
Upvote 0
I do like coding, a LOT. However, the computers I need to use this on are in a secure area, on a secure network. Therefore, all macros are disabled. I really appreciate the effort, but I can't use your code. Cheers!
This simply didn't go where I meant it to. It's been a long time since I used standard BBS
 
Upvote 0
I do like coding, a LOT. However, the computers I need to use this on are in a secure area, on a secure network. Therefore, all macros are disabled. I really appreciate the effort, but I can't use your code. Cheers!
did you try lrobbo314's non-vba solution? i'm SO curious to know how/why it works!
 
Upvote 0
Or a non-VBA solution.

ExpandIP.xlsm
CDEF
1AA5AF
2CG26DG
3BZZ3CAC
Sheet10
Cell Formulas
RangeFormula
F1:F3F1=SUBSTITUTE(LEFT(CELL("address",OFFSET(INDIRECT(C1&"1"),,D1)),SEARCH("$",CELL("address",OFFSET(INDIRECT(C1&"1"),,D1)),2)-1),"$","")
This is seemingly PERFECT. I wouldn't have come up with this solution on my own, for sure. Thank you, so much. Your response will enable me to create the WIP spreadsheet that will save me HOURS every day. Kudos!
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,847
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top