+ Reply to Thread
Results 1 to 6 of 6

Create a sequence based on a date in another column

  1. #1
    Registered User
    Join Date
    08-03-2020
    Location
    Mississauga, Canada
    MS-Off Ver
    Office 365
    Posts
    3

    Create a sequence based on a date in another column

    Hello All,

    Thanks in advance for reading this.

    I am looking at created a numbered sequence column that depends on the date in another column.

    Date Sequence 1.jpg

    If you see the pic above, I want to auto-create the "Sequence" column (N) when I enter a date in the previous column (M). The number in the column is based on how small or large the date is. Example, 6th Aug is the smallest date in the column, so the sequence is 1. 8th Aug is next, so it get 2 and so on. If I enter 5th Aug in an empty cell in that column (M), the sequence should completely change to accommodate a smaller date entered. This should also hold for any date I enter, so if I enter 13th Aug, it should become 5 and 21st Aug should move over to 6!

    I hope I have been able to explain what I need! Any help would be highly appreciated!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,980

    Re: Create a sequence based on a date in another column

    Welcome to the forum.

    Have you tried the RANK function?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,888

    Re: Create a sequence based on a date in another column

    If you don't need it to be sequential.
    i.e. since there are two 6-Aug-20, 8-Aug-20 = 3

    Then you can use..
    = RANK.EQ(M2,$M$2:$M$9,1)

    Copy down.

    Alternate method is to use Unique(Range) to extract unique dates in another area, use Rank on this column. Then use lookup to return applicable sequence to original.


    See attached for sample using Unique.

    Note: $H$2# is new array reference and references array result of UNIQUE() function in this case.

    EDIT: On second thought, you can skip the look up part and just use RANK.EQ(M2,$H$2#,1)
    $H$2# should be replaced with where you entered Unique() function.
    Attached Files Attached Files
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  4. #4
    Registered User
    Join Date
    08-03-2020
    Location
    Mississauga, Canada
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Create a sequence based on a date in another column

    Thanks for your response. I tried RANK, but did so without UNIQUE as suggested by CK76, so it did not work for me.

  5. #5
    Registered User
    Join Date
    08-03-2020
    Location
    Mississauga, Canada
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Create a sequence based on a date in another column

    Quote Originally Posted by CK76 View Post
    If you don't need it to be sequential.
    i.e. since there are two 6-Aug-20, 8-Aug-20 = 3
    ...
    Thank you so much. This is much better, but I have a small issue now. In order to make this practical, I used the UNIQUE() on the entire column as I keep adding rows and I dont want to edit the unique array every time. Now, the blank rows register as "1900-01-00" and always get the sequence 1.

    Any way to fix this? I will also try some stuff in the meantime!

    EDIT: Fixed it. Used the FILTER function to disregard blanks =UNNIQUE(FILTER(COL,COL<>""))
    Last edited by gmlshd; 08-04-2020 at 01:00 PM.

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,888

    Re: Create a sequence based on a date in another column

    You are welcome

    Used the FILTER function
    That's one way to do it.

    Another is to create dynamic named range or use Excel structured table.

    If you are satisfied with the solution(s) provided, please mark the thread as solved using thread tools found at top of your initial post.

+ 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. [SOLVED] Difficult COUNT IF problem (sequence based on date)
    By qwertz87 in forum Excel Formulas & Functions
    Replies: 28
    Last Post: 07-10-2019, 10:51 AM
  2. Formula to Sequence Based on Date and Name
    By blens1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-20-2018, 04:03 AM
  3. Replies: 1
    Last Post: 11-29-2017, 05:13 PM
  4. Sequence numbers based on date and independent of column sort order
    By bedepe in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 02-21-2014, 07:32 PM
  5. sequence number based on date
    By denise in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-19-2014, 03:09 PM
  6. [SOLVED] Creating a sequence based on numbers in one column and adding "01,02..." to a new sequence
    By JCR1968 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2013, 08:06 AM
  7. Create a numerical sequence in a column: From 1 to ....
    By Depechez in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-18-2006, 12:50 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