Forum Discussion
Mtumushi
Mar 11, 2021Copper Contributor
Transferring specific numbers from a column to a column
How do I move the specific numbers to a column that correspond to the numbers.. Kindly assist For example 1,2,3,5,9 and they are about 500 and I want to copy for example 9 to column 9..
- Mar 11, 2021
Hi Mtumushi
If I understand the requirement correctly, you need below formula:
=IFERROR(INDEX($A:$A,MATCH(COLUMN(),$A:$A,0),1),"")
Please let me know if it works for you. A sample file is also attached for your reference.
Thanks
Tauqeer
Mtumushi
Mar 11, 2021Copper Contributor
May be you can share your email.. Thanks
HansVogelaar
Mar 11, 2021MVP
Thank you for your email. Try this macro:
Sub MoveNumbers()
Dim r As Long
Dim m As Long
Dim a() As String
Dim i As Long
Dim c As Long
Application.ScreenUpdating = False
m = Cells(Rows.Count, 3).End(xlUp).Row
For r = 2 To m
a = Split(Cells(r, 3).Value, ", ")
For i = 0 To UBound(a)
If LCase(a(i)) Like "other*" Then
Cells(r, 11) = "other"
Else
c = a(i)
Cells(r, c + 3).Value = c
End If
Next i
Next r
Application.ScreenUpdating = True
End Sub