+ Reply to Thread
Results 1 to 8 of 8

If Date is between two Dates in a table, show value of column

  1. #1
    Registered User
    Join Date
    02-14-2023
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2202 Build 16.0.14931.20858) 64-bit
    Posts
    23

    If Date is between two Dates in a table, show value of column

    Hello, I'm trying to make a formula to show the hourly wage based upon a table which tracks pay increases. I can get it to work for the first month, but it needs to work with the range of dates, and thus far all I've gotten is a spill, and I'd prefer it return the specific value. Any help would be appreciated. I attached a sample workbook, which probably makes more sense of what I'm wanting to do that these words.
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,139

    Re: If Date is between two Dates in a table, show value of column

    you wage date starts on the 30th June 22 - But the table goes back to 1st june - so you need some dates which cover the table you are trying to create
    what was the salary before 30th june

    you table uses 1st as a date
    On 21st nov - it goes to 22 - but the date in the table is 1st - do you just want to consider a month ???
    also oct shows 22 , i guess that maybe a typo

    you are also not showing data after this month - so you want that to be blank - after MAY 23



    =INDEX($E$6:$E$16,MATCH(K5,$C$6:$C$16,1))

    we can use EOMONTH()

    =INDEX($E$6:$E$16,MATCH(EOMONTH(K5,0),$C$6:$C$16,1))

    exclude any dates after this month
    =IF(EOMONTH(K5,0)>TODAY(),"",INDEX($E$6:$E$16,MATCH(EOMONTH(K5,0),$C$6:$C$16,1)))

    regardless of the date in the table - it will check to the end of that month
    Attached Files Attached Files
    Last edited by etaf; 05-11-2023 at 10:07 AM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,186

    Re: If Date is between two Dates in a table, show value of column

    Here's a 365 way:

    =LET(d,Table2[Date],dd,IF(d="","",DATE(YEAR(d),MONTH(d),1)),p,Table2[Pay],vl,CHOOSE({1,2},dd,p),VLOOKUP(K5,vl,2,1))

    Your lookup list has October and November the wrong way round!
    Attached Files Attached Files
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,186

    Re: If Date is between two Dates in a table, show value of column

    Updated - this might be required:

    =LET(m,MAX(Table2[Date]),i,INDEX(Table2[Days],MATCH(m,Table2[Date],0)),t,m+i,d,Table2[Date],dd,IF(d="","",DATE(YEAR(d),MONTH(d),1)),p,Table2[Pay],vl,CHOOSE({1,2},dd,p),IF(K5<=t,VLOOKUP(K5,vl,2,1),""))
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: If Date is between two Dates in a table, show value of column

    or a SPILL array... delete expected results and use:

    =LET(A,FILTER(Table2,Table2[Date]<>""),XLOOKUP(K5:K18,EOMONTH(INDEX(A,,1),-1)+1,INDEX(A,,3),,-1))

    Results fill down the column automatically.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  6. #6
    Registered User
    Join Date
    02-14-2023
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2202 Build 16.0.14931.20858) 64-bit
    Posts
    23

    Re: If Date is between two Dates in a table, show value of column

    wow thanks. Yea I didn't notice that I messed up the dates. The reason the table on the right only has those two dates is because those are the dates salary changed, the first date is the starting date of the job. I'm trying to comprehend the formula you made. The "Days" column is the number of days between raises so I'm not sure why that column is in your formula, but it works. I tested it by adding the upcoming raise and it all fills out. Thank you very much, I'm going to try and understand your formula now so I can replicate similar things in the future. Again, thanks very very much!

  7. #7
    Registered User
    Join Date
    02-14-2023
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2202 Build 16.0.14931.20858) 64-bit
    Posts
    23

    Re: If Date is between two Dates in a table, show value of column

    Quote Originally Posted by AliGW View Post
    Updated - this might be required:

    =LET(m,MAX(Table2[Date]),i,INDEX(Table2[Days],MATCH(m,Table2[Date],0)),t,m+i,d,Table2[Date],dd,IF(d="","",DATE(YEAR(d),MONTH(d),1)),p,Table2[Pay],vl,CHOOSE({1,2},dd,p),IF(K5<=t,VLOOKUP(K5,vl,2,1),""))
    This worked perfectly, just have to figure out how what you did works so I can do it again in other scenarios! thank you for your time!

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,186

    Re: If Date is between two Dates in a table, show value of column

    Glad to have helped.

    If you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

+ 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] How to show all dates in one column and time intervals + count in a pivot table?
    By cph020283 in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 06-02-2021, 06:37 PM
  2. [SOLVED] Formula to show the latest date in a given year from a column of dates
    By Mgc26133 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-14-2018, 10:00 AM
  3. Pivot table show dates instead of sum in value
    By cabry in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-03-2014, 01:29 AM
  4. Replies: 3
    Last Post: 04-17-2014, 09:50 PM
  5. Macro to show date range from 'custom' column (Quarter 1) from list of dates
    By danlRB80 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-02-2013, 09:16 AM
  6. Replies: 0
    Last Post: 05-12-2010, 05:01 PM
  7. expanding a start date and end date to show all the dates in a list
    By musicman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2005, 04: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