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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,215,734
Messages
6,126,542
Members
449,316
Latest member
sravya

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