need solution for the following , in excel 2019

raghunathreddy

New Member
Joined
Oct 23, 2023
Messages
9
Office Version
  1. 2019
Platform
  1. Windows
Column1
Column2
Output
1a1a
2b1b
3c1c
4d1d
5e2a
2b
2c
2d
3a
3b
3c
3d
4a
4b
4c
4d
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Assuming result column is F, F1 formula will be:
Excel Formula:
=IF(ROW()-ROW($F$1)+1>COUNTA(A:A)*COUNTA(B:B),"",INDEX(A:A,INT((ROW()-ROW($F$1))/COUNTA(B:B)+1))&INDEX(B:B,MOD(ROW()-ROW($F$1),COUNTA(B:B))+1))
 
Upvote 0
Solution
VBA approach:
VBA Code:
Sub test()
    Application.ScreenUpdating = False
    Dim rng As Range, srcRng As Range, lRow As Long, v As Variant, arr() As Variant, i As Long, ii As Long, x As Long
    lRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    v = Range("A1:A" & lRow).Resize(, 2).Value
    For i = LBound(v) To UBound(v)
        For ii = 1 To lRow
            x = x + 1
            ReDim Preserve arr(1 To x)
            arr(x) = v(i, 1) & v(ii, 2)
        Next ii
    Next i
    Range("C1").Resize(x - 1) = Application.Transpose(arr)
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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