Autofill A B C D...AA AB...

cmendes

Board Regular
Joined
Jan 24, 2011
Messages
66
Hello,

I remember that excel could complete a sequence is we gave it the first elements.
In this case I'm writing in three different cells (same column) A, B C and I want excel to do the rest as I drag it down: D E F and so on. But if do it I get A B C again...
Is there anything that i have to do??
I'm using Excel for mac 2011
Thanks in advance,
C
 
ZZZZZZZZZZ corresponds to 146813779479510
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
My Questions is...
Why do you want this?
Are you planning on using these in a formula to reference Cells later on?

There are easier ways, can you explain your larger goal?


But anyway, try this

=SUBSTITUTE(ADDRESS(1,ROWS(A$1:A1),4),1,"")

Jonmo1 I know this is an old thread, but I have been looking for this solution for over a year. It turns out to be so simple. Aren't they usually?

Anyway thanks. :)
 
Upvote 0
You could try this UDF approach
Put "A" in A1 (no quotes) and =NEXTSTRING(A1) in A2 and drag down as needed.

Code:
Function NextString(ByVal aString As String) As String
    Dim suffix As String
    If aString = vbNullString Then
        NextString = "A"
    ElseIf Right(aString, 1) = "Z" Then
        NextString = NextString(Left(aString, Len(aString) - 1)) & "A"
    Else
        Mid(aString, Len(aString), 1) = Chr(Asc(Right(aString, 1)) + 1)
        NextString = aString
    End If
End Function

this is great.
 
Last edited:
Upvote 0
Hello all,
I want also to give unique ID starting from AA0001 to ZZ9999
means after AA9999 it should go to AB0001
please help
 
Upvote 0
Perhaps
VBA Code:
Function NextIDNumber(strCurrent As String) As String
    Dim curIndex As Long, curPrefix As String
    Dim nextIndex As String, nextPrefix As String
    curIndex = Int(Val(Right(strCurrent, 4)))
    curPrefix = UCase(Left(strCurrent, 2))
    
    nextIndex = Right("00000" & (curIndex + 1), 4)
    If nextIndex = "0000" Then
        If Right(curPrefix, 1) = "Z" Then
            nextPrefix = Chr(Asc(Left(curPrefix, 1)) + 1) & "A"
        Else
            nextPrefix = Left(curPrefix, 1) & Chr(Asc(Right(curPrefix, 1)) + 1)
        End If
        nextIndex = "0001"
    Else
        
        nextPrefix = curPrefix
    End If
    NextIDNumber = nextPrefix & nextIndex
End Function
 
Upvote 0
Thank you,
But I can’t do it without code?
Mean using excel only?
 
Upvote 0
But I can’t do it without code?
Put AA0001 in cell A1, then put this formula in cell A2 and copy it down...

=CHAR(CODE(A1)+(RIGHT(A1,5)="Z9999"))&IF(RIGHT(A1,5)="Z9999","A",CHAR(CODE(MID(A1,2,1))+(RIGHT(A1,4)="9999")))&IF(RIGHT(A1,4)="9999","0001",TEXT(RIGHT(A1,4)+1,"0000"))

Note: The last cell in Column A for my system (A1048576) will contain the code EA8680 so you will never get anywhere near ZZ9999.
 
Upvote 0
Thank you very much for the formula, I will try it soon.
For for completing to ZZ9999 can continue in another sheet ?
 
Upvote 0
Put EA8681 (the next code) in cell A1 of that other sheet, then put the formula I posted in cell A2 on that sheet and copy it down.
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,322
Members
449,218
Latest member
Excel Master

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