+ Reply to Thread
Results 1 to 8 of 8

Date Buckets - reversing order on vlookup?

  1. #1
    Registered User
    Join Date
    08-30-2016
    Location
    Edmonton, Canada
    MS-Off Ver
    2016 64b
    Posts
    92

    Date Buckets - reversing order on vlookup?

    Hey all,

    I am trying to create buckets for date information using formulas. The objective is to put the correct WE date beside the actual date.

    I went with Vlookup @ Range = "true", but the information is grouping in reverse to what would make this perfect.

    Help is appreciated.

    Cheers,
    Attached Files Attached Files
    Last edited by happydays886; 08-31-2016 at 05:52 PM.

  2. #2
    Registered User
    Join Date
    08-30-2016
    Location
    Edmonton, Canada
    MS-Off Ver
    2016 64b
    Posts
    92

    Re: Date Buckets - reversing order on vlookup?

    So, I did figure this out using a completely different approach. If anyone is interested in exactly what I was trying to do,
    - 365 days in a year, 5 years data => bucket these by a uniform week-ending date and month for a pivot extract.

    This is accomplished through:=date(year(f3),month(f3),day(f3)+choose(weekday(f3),6,5,4,3,2,1,0,-1))

    The initial logic was to reverse the way a "true" range in the vlookup organizes information.
    Last edited by happydays886; 08-31-2016 at 06:20 PM.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Date Buckets - reversing order on vlookup?

    Or

    =F3 + 7 - WEEKDAY(F3)

    I don't know what you mean for the rest of the question.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    08-30-2016
    Location
    Edmonton, Canada
    MS-Off Ver
    2016 64b
    Posts
    92

    Re: Date Buckets - reversing order on vlookup?

    Jesus. That is one efficient formula! Wow.

    I'll explain better.

    Using the formla =F3-WEEKDAY(F3), you end up with the same result when applying the vlookup(F3,___,2,TRUE) in the sense that they both 'count backwards' ("TRUE" in vlookup does the reverse count).

    F3+7-weekday(F3) counts forward 7.

    I hoping you could reverse what happens when you have "TRUE" in the vlookup, to essentially give it that forward looking output (like the "+7" in the formula you wrote).

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

    Re: Date Buckets - reversing order on vlookup?

    You can use this formula in G3:

    =IF($F3<=$B$4,$C$4,INDEX(C$4:C$8,MATCH($F3,$B$4:$B$8,TRUE)+IF(ISNUMBER(MATCH($F3,$B$4:$B$8,FALSE)),0,1)))

    Format as a date, then copy down. Then use this in H3:

    =IF($F3<=$B$4,$D$4,INDEX(D$4:D$8,MATCH($F3,$B$4:$B$8,TRUE)+IF(ISNUMBER(MATCH($F3,$B$4:$B$8,FALSE)),0,1)))

    (changes shown in red). You don't need to format this as a date, as your entries in column D are text values.

    Hope this helps.

    Pete

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Date Buckets - reversing order on vlookup?

    Quote Originally Posted by happydays886 View Post
    I hoping you could reverse what happens when you have "TRUE" in the vlookup, to essentially give it that forward looking output (like the "+7" in the formula you wrote).
    Does Pete's formula do what you want?

    If not, please describe the result you're trying to achieve, and give an example.

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

    Re: Date Buckets - reversing order on vlookup?

    The example is shown in the green cells in the sample file, shg. The OP wants to obtain the next row's data from where the match occurs (unless it is an exact match), so that's why I changed it to INDEX/MATCH.

    (I think)

    Pete

  8. #8
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Date Buckets - reversing order on vlookup?

    G3: =VLOOKUP(MIN(IF($B$4:$B$8>=$F3,$B$4:$B$8)),$B$4:$D$8,1+COLUMNS($G3:G3),0)

    Press Ctrl+Shift+Enter, not just Enter
    Copy down and across

+ 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. Reversing data order
    By MT49 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-11-2016, 09:12 AM
  2. reversing the order of a list
    By rookie37 in forum Excel General
    Replies: 2
    Last Post: 11-08-2014, 06:10 AM
  3. Mac 2011, Stock Chart Reversing Date Order Problem
    By MJSlattery in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 11-16-2013, 03:22 PM
  4. Reversing Order of Chart
    By prr in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-02-2009, 05:20 AM
  5. Reversing the Word Order within a String
    By oraclenet in forum Excel General
    Replies: 2
    Last Post: 10-06-2008, 10:46 PM
  6. Autofill- Reversing Order
    By Earl in forum Excel General
    Replies: 4
    Last Post: 07-31-2006, 05:18 PM
  7. reversing row order
    By Jamie Morken in forum Excel General
    Replies: 1
    Last Post: 05-31-2005, 03:05 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