+ Reply to Thread
Results 1 to 4 of 4

Rank Value of Column Based on Current Date (Week)

  1. #1
    Registered User
    Join Date
    09-22-2010
    Location
    California
    MS-Off Ver
    Office 2007
    Posts
    13

    Rank Value of Column Based on Current Date (Week)

    I'm setting up a weight loss tracking sheet and in Column A I'd like to indicate the Rank of a user as the weeks progress. With that being said, I only want the rank to reflect the current week and used the WEEKNUM() and TODAY() functions to try and set this up properly.

    I have two issues:

    1) My Rank formula is just cluttered -- there has to be a better way of doing this than nesting so many IF statements.
    Please Login or Register  to view this content.
    2) Because of the New Year transition and my use of WEEKNUM(), 01/01/2021 - 01/02/2021 are in a bit of a limbo -- it's not the end of the world, but during those two days the rank function will not display.

    https://docs.google.com/spreadsheets...it?usp=sharing

  2. #2
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Rank Value of Column Based on Current Date (Week)

    Try in A5 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Good luck!

  3. #3
    Registered User
    Join Date
    09-22-2010
    Location
    California
    MS-Off Ver
    Office 2007
    Posts
    13

    Re: Rank Value of Column Based on Current Date (Week)

    Sorry for the delayed response. It appears to work exactly as I'd hoped. I'm a little embarrassed to admit that I'm not fully understanding WHY it's working. In any case, thank you very much again.

  4. #4
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Rank Value of Column Based on Current Date (Week)

    You're welcome. Glad to help. Thanks for the feedback and for the reputation added.
    As for the formula, it is known that a lookup formula is usually a far better solution than nested IFs.

    The two arguments for the RANK function are Number and Array.

    The Number is given by this formula:
    =INDEX(C5:N5,MATCH(1,1+$C$17:$N$17,0)-1)
    I used row 17, because no filled cell in it is likely to be zero. So the MATCH function is to find 1 in array 1+C17:N17, resulting the first blank cell (blank+1). So, subtracting 1, I get the right cell in range C5:N5.

    The Array part, is brought by this other formula:
    =INDEX($C$5:$N$16,0,MATCH(1,1+$C$17:$N$17,0)-1)
    Using the same artifice as above, I find the right column.
    Then the zero for row reference (INDEX($C$5:$N$16,0,...) results all rows in range C5:N16, in other words, an array (H5:H17 or the last column with values).

    I hope this will help you understand how the formula works.
    Last edited by Estevaoba; 01-15-2021 at 07:41 PM.

+ 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] Dynamic column headers based on the current week number
    By Gazz106 in forum Excel General
    Replies: 0
    Last Post: 01-08-2018, 07:09 AM
  2. [SOLVED] Day of the week based on date in adjacent column
    By mknispel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-08-2014, 11:40 PM
  3. [SOLVED] Set PivotTable Filter to Current Day, Current Week, Current Month, or Current Year
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2014, 08:31 AM
  4. [SOLVED] Date Formula to Return Week Number in Current Month based on Reporting Period
    By jeversf in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-25-2013, 12:10 PM
  5. Replies: 4
    Last Post: 03-21-2011, 05:37 PM
  6. Highlight Only Current Week Based on Date
    By Kumara_faith in forum Excel General
    Replies: 10
    Last Post: 11-17-2010, 04:52 PM
  7. Replies: 1
    Last Post: 08-15-2005, 05:05 PM

Tags for this Thread

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