+ Reply to Thread
Results 1 to 16 of 16

Trying to fill in the gaps

  1. #1
    Registered User
    Join Date
    11-24-2010
    Location
    Prague
    MS-Off Ver
    Excel 2007
    Posts
    9

    Trying to fill in the gaps

    Hi,

    I'm trying to get Excel to save me some time filling in years between a start year and an end year.

    Basically I have a column of start years, and a column of end years, and I need a column of all the years in-between seperated by pipes.
    So, we should have something like:
    Cell 1: 1975
    Cell 2: 1980
    Cell 3: 1975|1976|1977|1978|1979|1980

    I have about 700 of these so any help would be much appreciated!

  2. #2
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: Trying to fill in the gaps

    Do you have always the same 5 year difference between the start and the end year? If don't, is there a (theoretical) maximum number of difference?
    An example file is never useless!

    Tried an example function of mine and got errors?
    - Had you found them, replace ; with , and , with .

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Trying to fill in the gaps

    this is one way with functions max range 1991-2011 ie a 21 year span
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Trying to fill in the gaps

    Assuming the start year(s) are in column A and the end year(s) are in column B, one way:

    Please Login or Register  to view this content.

    The output will be in column C

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: Trying to fill in the gaps

    Yeah I was also working with a little macro with accessory cols. It has a 20 year limit as well.

    Edit: never mind. It has a bug :|
    Attached Files Attached Files
    Last edited by KiPA; 11-24-2010 at 01:35 PM. Reason: Fail

  6. #6
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: Trying to fill in the gaps

    Should be better.
    Attached Files Attached Files

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Trying to fill in the gaps

    There's no limit with the code I provided. No helper columns either.

    Regards

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Trying to fill in the gaps

    ok a udf use as =unconcat(a1,b1)
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-24-2010
    Location
    Prague
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Trying to fill in the gaps

    Thank you so much guys. There are so many great solutions, I don't know which one to use first!

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Trying to fill in the gaps

    You're welcome. Thanks for the feedback.

  11. #11
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: Trying to fill in the gaps

    Glad to help

    ---

    Quote Originally Posted by martindwilson View Post
    ok a udf use as =unconcat(a1,b1)
    I have ; separator with functions but I'm not sure how I have to use them when dealing with custom functions. I cannot get this working and I've tried all four considerable alternatives: a) , at cell and at code, b) ; at cell and at code, c) ; at cell and , at code, d) , at cell and ; at code.

    Any advices?

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Trying to fill in the gaps

    change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: Trying to fill in the gaps

    Yeah that didn't help. I strongly believe that the solution is related to that first code row. See, if I change the code so that the separator would be ; the editor reminds me: "Expected: list separator or )" so the separator must be comma (,). When I look the udf cell it yells "#NAME?"
    So if I change the udf from =unconcat(A1;B1) to =unconcat(A1,B1) I got "The formula you typed contains an error." which usually in simple cases like this is because I used , separator instead of expected ;

    But! Thanks anyway! I'll try to find (typical) udf separator problems with search engines.

  14. #14
    Registered User
    Join Date
    11-23-2010
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    26

    Re: Trying to fill in the gaps

    Can someone please help me with this... I need this bit urgent.. Sorry if i disturbed anyone.. I am new.

    http://www.excelforum.com/excel-new-...-attached.html

  15. #15
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: Trying to fill in the gaps

    Quote Originally Posted by beautify5 View Post
    Can someone please help me with this... I need this bit urgent.. Sorry if i disturbed anyone.. I am new.

    http://www.excelforum.com/excel-new-...-attached.html
    No need to be sorry. Though if you have not received (understandable) answers in your thread you should put a new post there to bring it up in the list again. Also you might want to check "Want to get your question answered quickly?" from rules

  16. #16
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Trying to fill in the gaps

    better still follow the rules ands start your own thread

+ 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