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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Dave87

Board Regular
Joined
Apr 22, 2020
Messages
107
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
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?
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
10,940
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,132,706
Messages
5,654,845
Members
418,155
Latest member
demasisi

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
Top