+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : How to merge two columns but to replace only the blank cells with the previous column

  1. #1
    Registered User
    Join Date
    11-10-2009
    Location
    Prague, Czech Republic
    MS-Off Ver
    Excel 2007
    Posts
    6

    How to merge two columns but to replace only the blank cells with the previous column

    Hi!

    I have a sheet with two columns A and B from 1 to 3002.

    Column B has some cells filled where as cell A is completely full. I need another column maybe C for example if B2 is empty then C2 will be equal to A2. The other option is if B2 is not empty then C2 will be equal to B2. How can I do that for only one sheet in the whole workbook at a time.

    Any help will be most appreciated. Thanks

    Sanyam

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to merge two columns but to replace only the blank cells with the previous co

    You don't have to use a separate column, you can fill in the blanks right in column B if that's your real goal:

    Please Login or Register  to view this content.
    How/Where to install the macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet

    The macro is installed and ready to use. Press Alt-F8 and select FillInTheBlanks from the macro list.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to merge two columns but to replace only the blank cells with the previous co

    If you really want a formula in column C, then put this in C1 and copy down:

    =IF(B1="",A1,B1)

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to merge two columns but to replace only the blank cells with the previous co

    Another way since you said "Merge Two Columns"...

    1) Highlight column B
    2) Copy it
    3) Highlight column A
    4) Select Edit > Paste Special > Skip Blanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1