+ Reply to Thread
Results 1 to 5 of 5

Duplicate value from bottom of one column to top of another

  1. #1
    Registered User
    Join Date
    11-30-2016
    Location
    San Diego, CA
    MS-Off Ver
    2013
    Posts
    2

    Question Duplicate value from bottom of one column to top of another

    I've got a series of XYZ position data that I've binned into 5 ranges so that I can plot each range in a different color in an XY scatter plot (only plotting 2 points of the position at a time). I would like to use smooth lines to connect these data points, but when switching from range to range a gap is plotted. And in cases where the data is in a particular range for only 1 data point, nothing is plotted at all (can't connect 1 data point with a line and all). The attached image should do better justice to my problem than my description.

    Excel help 1.jpg

    I found a manual workaround where if I copy the last data point in a bin above the data point in the next bin then the gap is filled. The second image should help explain this part as well.

    Excel help 2.jpg

    So now I'm trying to figure out how to automate this action and could use some help. Any ideas on how I can accomplish this?

    Thanks in advance,
    Adam
    Last edited by abunn3; 11-30-2016 at 02:58 PM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Duplicate value from bottom of one column to top of another

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,279

    Re: Duplicate value from bottom of one column to top of another

    Select all your cells in the data block as one area - columns 4 to the end, and use this macro:

    Sub TestMacro2()
    Dim rngA As Range

    For Each rngA In Selection.SpecialCells(xlCellTypeConstants).Areas
    With rngA.Offset(-1).SpecialCells(xlCellTypeBlanks)
    .FormulaR1C1 = "=RC[-3]"
    .Value = .Value
    End With
    Next rngA
    End Sub
    Bernie Deitrick
    Excel MVP 2000-2010

  4. #4
    Registered User
    Join Date
    11-30-2016
    Location
    San Diego, CA
    MS-Off Ver
    2013
    Posts
    2

    Re: Duplicate value from bottom of one column to top of another

    Thank you for the response. I'll give this a try. If it's not too much to ask can you help me understand what's going on in the code? I've not delved into writing macros and mostly just work with formulas in the sheets. Thanks.

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,279

    Re: Duplicate value from bottom of one column to top of another

    Basically, you have blocks of data. So my code finds each block of data, finds the blank row above it, and fills those cells with the values from the 3 columns to the left on the same row, using formulas that get converted to values.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 8
    Last Post: 06-25-2015, 08:59 AM
  2. [SOLVED] Code to check cell against a list for duplicate, if no duplicate, post to bottom of list..
    By wannabacat in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2015, 11:42 AM
  3. Replies: 1
    Last Post: 06-01-2013, 01:27 AM
  4. Replies: 2
    Last Post: 03-09-2013, 10:14 PM
  5. [SOLVED] Macro to sort a list with duplicates and add bottom border for last duplicate
    By kuntilfusk7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2012, 09:44 AM
  6. check for duplicate entries - from bottom to top?
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-28-2011, 05:27 AM
  7. Replies: 1
    Last Post: 04-09-2006, 04:30 PM

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