Combining Columns with Dynamic Values

whalay

New Member
Joined
Jan 30, 2014
Messages
5
Dear Pros,

Please how can I use formula to create COLUMN C from A and B?

1586788454874.png
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
i think you need to have a look at that picture again, there doesnt seem to be any obvious link between column C and columns A & B... what are you trying to do?
 
Upvote 0
There actually is a well-defined pattern to the results in column C, but it would be quite complicated for a formula. I took a stab at it, and ran out of time. It's actually far better suited to a VBA macro:

VBA Code:
Sub Reorg()
Dim MyData As Variant, cbreak As String, r As Long, i As Long

    MyData = Range("A2:B" & Cells(Rows.Count, "A").End(xlUp).Row).Value
    cbreak = ""
    r = 2
    
    For i = 1 To UBound(MyData)
        If MyData(i, 1) <> cbreak Then
            Cells(r, "C") = MyData(i, 1)
            Cells(r, "C").Font.Bold = True
            cbreak = MyData(i, 1)
            i = i - 1
        Else
            Cells(r, "C") = MyData(i, 2)
        End If
        r = r + 1
    Next i
End Sub

This only took about 5 minutes to write, and it allows bolding the headers which you can't do in a formula.
 
Upvote 0

Forum statistics

Threads
1,223,630
Messages
6,173,451
Members
452,514
Latest member
cjkelly15

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