Merge two columns to one

abberyfarm

Well-known Member
Joined
Aug 14, 2011
Messages
733
Hi there,

I have zeros is Column A and Column B and they are always on different rows. Would somebody know a macro to either merge Columns A and B into Column C like below or else place a 0 in Column C if there is a 0 in Column A or B.

Thank You

Excel Workbook
ABC
1ABC
200
300
4
500
600
7
800
900
1000
1100
1200
Sheet1
 
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Perhaps

Code:
Sub test()
Dim LR As Long, i As Long
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
For i = 1 To LR
    If Range("A" & i).Value <> "" Or Range("B" & i).Value <> "" Then Range("C" & i).Value = 0
Next i
End Sub
 
Upvote 0
You could also do this without a macro
=IF(COUNTIF(A2:B2,0)>0,0,"")
Drag/Fill Down

Copy and Paste > Paste Special > Values
 
Upvote 0

Forum statistics

Threads
1,196,480
Messages
6,015,449
Members
441,895
Latest member
Zululander

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