+ Reply to Thread
Results 1 to 18 of 18

Help with formula that will copy when blank but reset/skip when not.

  1. #1
    Registered User
    Join Date
    11-13-2012
    Location
    ann arbor
    MS-Off Ver
    Excel 2010
    Posts
    67

    Help with formula that will copy when blank but reset/skip when not.

    Hi!

    I have a sheet that looks like this: http://i.imgur.com/rQ0kq.png

    And I need it to looks like this: http://i.imgur.com/Vg0BN.png

    It is a very big sheet and basically there is no way to manually fill in the blank cells with the proceeding value. I need to be able to copy down the number (Cell: A1) into the blank cells (Cell: A2:A4) below it and then when the new number appears (Cell: A5) it needs to not override it but skip it and then copy it down until the next number appears.

    I feel like this is hard to explain in words but the pictures above do a better job. Any help at all would be greatly appreciated!
    Last edited by LightingPop; 11-13-2012 at 07:27 PM.

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Help with formula that will copy when blank but reset/skip when not.

    Actually, the pictures above are identical.

  3. #3
    Registered User
    Join Date
    11-13-2012
    Location
    ann arbor
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Help with formula that will copy when blank but reset/skip when not.

    I just caught that and edited it sorry.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Help with formula that will copy when blank but reset/skip when not.

    Your second picture is the same as the first, but I think I know what you want to do, and here's a bit of Excel magic:

    First, select all the cells from A1 down to where you want to fill in the blanks.
    Then press F5, and click on Special, and then against Blanks, then OK.
    Then begin to enter a formula by typing =
    Then click on the cell above the active cell (i.e. A1)
    Then say the magic word ...

    and hold down the CTRL key and press <Enter>

    Abracadabra - all the blanks cells are filled with the value from the cell above.

    Magic !!

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    11-13-2012
    Location
    ann arbor
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Help with formula that will copy when blank but reset/skip when not.

    Thanks for the help but it doesn't seem to work. Every time I try it only recognizes one bank of blanks cells and not all the blank cells in the column.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Help with formula that will copy when blank but reset/skip when not.

    You need to highlight all the cells in that column that you want to affect when you start.

    Here's another approach to the beginning:

    Select cell A1
    Press F5, then click on Special, then click on Current Region, then OK
    Press F5 again, click on Special, then blanks, then OK

    and carry on as above.

    Hope this helps.

    Pete

  7. #7
    Registered User
    Join Date
    11-13-2012
    Location
    ann arbor
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Help with formula that will copy when blank but reset/skip when not.

    Thanks. This is so frustrating. When go to special select blanks it only highlights about 20% of the blanks the first time and it doesn't copy the cell anyways. Then when I try again Excel says there are no blanks yet about 80% of the column has blanks.

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Help with formula that will copy when blank but reset/skip when not.

    Maybe those blanks were not really blanks - perhaps they contained spaces or other non-printable characters.

    Pete

  9. #9
    Registered User
    Join Date
    11-13-2012
    Location
    ann arbor
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Help with formula that will copy when blank but reset/skip when not.

    I did a copy and paste special values only and it still saw blanks were there wasnt.

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Help with formula that will copy when blank but reset/skip when not.

    Select cell A1, press the <end> key once, followed by the <down-arrow> key. If the cursor goes right down to the bottom of your list then there are no blank cells in the list, even if some of them look empty. In a column B cell against a cell which looks empty you can put this formula:

    =LEN(A_cell)

    which will tell you how many characters there are in that cell (should be zero for an empty cell).

    Hope this helps.

    Pete

  11. #11
    Registered User
    Join Date
    11-13-2012
    Location
    ann arbor
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Help with formula that will copy when blank but reset/skip when not.

    Yeah... there is some kind of unprintable values in all the cells. I thought if I did a copy to past special values only it would only copy the visible values. Is there another way?

    EDIT:

    When I click on the "blank" cells there is nothing in them at all not even an extra place.
    Last edited by LightingPop; 11-13-2012 at 08:40 PM.

  12. #12
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Help with formula that will copy when blank but reset/skip when not.

    Instead of putting that =LEN(A_cell) formula, put this one in a few places:

    =CODE(A_cell)

    this will give you the ASCII code of (the first one of) those characters. I suspect this will give you 160, which is the non-breaking space character, and which often finds its way into sheets if you have copied some data from a website.

    You can get rid of this in one operation using Find & Replace. Highlight column A, then CTRL-H, then in the Find What box you should hold down the Alt key and type 0160 on the numeric keypad. Leave the Replace box blank, then click Replace All.

    If the little formula returns 32 that is the code for a normal space, and you can use Find & Replace to get rid of that too in the same way.

    Hope this helps.

    Pete

  13. #13
    Registered User
    Join Date
    11-13-2012
    Location
    ann arbor
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Help with formula that will copy when blank but reset/skip when not.

    Ugh this is crazy, whenever I try the =CODE(A_cell) it bounces back with a #NAME?

  14. #14
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Help with formula that will copy when blank but reset/skip when not.

    Yes, but you have to put in the actual row reference. For example, if you are in B13, then the formula is:

    =CODE(A13)

    Then you can copy that down into other cells in column B where column A cells look empty.

    Pete

  15. #15
    Registered User
    Join Date
    11-13-2012
    Location
    ann arbor
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Help with formula that will copy when blank but reset/skip when not.

    Ok, I might be getting somewhere. It looks like this with the formula in:

    http://i.imgur.com/Ffm7N.png

  16. #16
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Help with formula that will copy when blank but reset/skip when not.

    Rather than post images of the screen, why don't you attach your workbook? Just get rid of any sensitive data that you might have first.

    Pete

  17. #17
    Registered User
    Join Date
    11-13-2012
    Location
    ann arbor
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Help with formula that will copy when blank but reset/skip when not.

    I attached it. The problem is I have about 12 other books that I need to do the same thing with so I kinda have to know how to do it.
    Attached Files Attached Files

  18. #18
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Help with formula that will copy when blank but reset/skip when not.

    Okay, there is something strange about this data that I don't quite understand. Using LEN, those cells that appear empty return a zero length, although <end> followed by <down-arrow> takes you to the bottom of the list, which implies that there is something in those cells. Anyway, here's what you should do with your copy of this file (and with the others):

    Highlight column A by clicking on the column identifier.
    Click on Data | Text-to-Columns
    Click Finish on the first panel.

    That seems to get rid of the anomalies, so you can then do the "magic" trick. I've done this in the attached file for you, so you can see what you end up with. If you want to sort this data afterwards, you must fix the values first.

    Hope this helps.

    Pete
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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