I have a list of 100 names in column A. For example John, Jacob, James.
I would like to add the numbers 1-99999 to each cell in column A.
I have the list of numbers, how can I add them to each cell to output like this ? John1 John2 John3 ... Jacob1 Jacob2 Jacob3
如果将以下公式放在单元格B1中并向下复制大约一百万行,则应获得所需的答案:
=INDEX(A:A, INT((ROW() - 1) / 99999) + 1) & (MOD(ROW() - 1, 99999) + 1)
This is a comment on copying down as an answer as I don't have enough reputation
if you place the formula provided by Phylogenesis in to the first cell in the column next to the column with your data the move your mouse to the bottom right hand corner of the highlighted cell the cursor will change in to a cross. Double click the mouse and this will automatically add the formula to all the appropriate cells - assuming there are no blanks
Try this small macro:
Sub NumberNames()
Dim jacob As Long, john As Long, james As Long
Dim i As Long
jacob = 1
james = 1
john = 1
For i = 1 To 100
With Cells(i, 1)
v = .Value
If v = "John" Then
.Value = .Value & john
john = john + 1
End If
If v = "Jacob" Then
.Value = .Value & jacob
jacob = jacob + 1
End If
If v = "James" Then
.Value = .Value & james
james = james + 1
End If
End With
Next i
End Sub
if your data starts out like:
James
Jacob
John
James
John
John
James
John
James
John
Jacob
John
James
James
John
John
James
John
James
James
it will end up like:
James1
Jacob1
John1
James2
John2
John3
James3
John4
James4
John5
Jacob2
John6
James5
James6
John7
John8
James7
John9
James8
James9
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.