+ Reply to Thread
Results 1 to 8 of 8

Copy from column to column without blanks but with a twist

  1. #1
    Registered User
    Join Date
    02-23-2015
    Location
    Perth Autralia
    MS-Off Ver
    2010
    Posts
    41

    Copy from column to column without blanks but with a twist

    Hi guys

    I am using the following simple formula to try and copy data from one column to another in the same spread sheet but blank cells are involved and I want the formula to bypass these

    Column H – range H13:H2500 – is used for a product code
    Column K – range K13:K2500 – is used for an edition code
    There will be instances where column H will contain a value but the corresponding cell in column K may not e.g. IF H13 contains a value then K13 may or may not contain a value
    IF a column H cell is blank however, the corresponding cell in column K will always be blank
    NOTE: There are no pre-existing formulas in either of these columns’ cells.

    Column AI – range AI13:AI2500 – is where I want to copy Column K cells to BUT based on the following argument:

    Formula is conditional on the H cell containing a value i.e.:
    IF the H cell contains a value then copy the value in the corresponding K cell, to the corresponding AI cell……..EVEN if the K cell is blank
    BUT, IF the H cell is blank then do nothing
    That is, I don't want column AI to have actual blanks

    H13 – 12345 K13 – 8 AI – 8
    H14 – 67890 K14 - AI -
    H15 – 98765 K15 – 4 AI – 4
    H16 - K16 - AI – 7
    H17 - K17 - AI -
    H18 – 65432 K18 – 7
    H19 – 81234 K19 -

    Hope this is clear enough for someone to help me out with an amended formula

    Cheers

  2. #2
    Forum Expert cbatrody's Avatar
    Join Date
    04-15-2014
    Location
    Dubai
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    2,136

    Re: Copy from column to column without blanks but with a twist

    Hi,

    You would get better help if you attach a sample workbook with enough data to demonstrate your requirement. Make sure your desired results are shown, mock them up manually if necessary. Remember to desensitize the file by removing all confidential information before upload!

    See the following URL for help on how to upload a file.
    http://www.excelforum.com/members/da...ch-a-file.html

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Copy from column to column without blanks but with a twist

    For future reference, its better to include a sample workbook so members dont need to retype (or copy/paste) your data

    Assuming your data looks something like this....
    H
    I
    J
    K
    13
    12345
    8
    8
    14
    67890
    0
    15
    98765
    4
    4
    16
    7
    17
    0
    18
    65432
    7
    19
    81234

    K13=IFERROR(INDEX($I$13:$I$19,SMALL(IF($H$13:$H$19<>"",ROW($H$13:$H$19)-12),ROWS($A$1:A1))),"")
    This is an ARRAY formula...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Then copy down as needed (also, adjust ranges as needed)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    02-23-2015
    Location
    Perth Autralia
    MS-Off Ver
    2010
    Posts
    41

    Re: Copy from column to column without blanks but with a twist

    Hi

    Thanks so much for your prompt response, I amended the formula to reflect the ranges so it looks like this:

    AI13=IFERROR(INDEX($K$13:$K$19,SMALL(IF($H$13:$H$19<>"",ROW($H$13:$H$19)-12),ROWS($A$1:A1))),"")

    Where AI13 is the first destination cell
    K is the values I want to copy
    And H is the pre condition

    However,it appears I've not done something because when I try the Ctrl Shift Enter it just flashes and won't apply the array brackets?

    Cheers

  5. #5
    Registered User
    Join Date
    02-23-2015
    Location
    Perth Autralia
    MS-Off Ver
    2010
    Posts
    41

    Re: Copy from column to column without blanks but with a twist

    I should have pointed out i don't get any sort of error it just doesn't apply the brackets?

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Copy from column to column without blanks but with a twist

    =IFERROR(INDEX( $I$13:$I$19,SMALL(IF($H$13:$H$19<>"",ROW($H$13:$H$19)-12),ROWS($A$1:A1))),"")
    =IFERROR(INDEX($K$13:$K$19,SMALL(IF($H$13:$H$19<>"",ROW($H$13:$H$19)-12),ROWS($A$1:A1))),"")

    They look pretty much the same. Can you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.

  7. #7
    Registered User
    Join Date
    02-23-2015
    Location
    Perth Autralia
    MS-Off Ver
    2010
    Posts
    41

    Re: Copy from column to column without blanks but with a twist

    Nah all good I made a blue
    Thanks so much I have added reputation...........so fast so damn clever............I'm learning but seems that light at the end of the tunnel don't seem to be gettin any closer!!!

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Copy from column to column without blanks but with a twist

    We all make em

    Happy to help and thanks for the rep

+ 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. How to copy one column to another but so no blanks are returned
    By Taupo58 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-17-2015, 04:22 AM
  2. How to copy one column to another but so no blanks are returned
    By Taupo58 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-17-2015, 03:07 AM
  3. Replies: 7
    Last Post: 10-26-2014, 06:01 PM
  4. Copy Column(s) based on another column dynamicly without blanks
    By johnmelvin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-23-2013, 12:24 PM
  5. Replies: 1
    Last Post: 08-13-2012, 10:59 AM
  6. Scan a Column A (numbers and blanks) and copy its contents WITHOUT BLANKS into Column B
    By bighandsam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2012, 05:16 PM
  7. [SOLVED] copy two columns without blanks in the first column
    By jeffm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2006, 10:55 AM

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