+ Reply to Thread
Results 1 to 8 of 8

Formula to look at a range of cells, match dates within the range and pull data.

  1. #1
    Registered User
    Join Date
    08-16-2017
    Location
    Madison, WI
    MS-Off Ver
    2011
    Posts
    20

    Formula to look at a range of cells, match dates within the range and pull data.

    I'm trying to do something that I'm not sure I can do with excel...but I'm hoping I'm wrong. In the attached spreadsheet, which is a leave tracker document for supervisors in my area to use to track leave usage, there's a drop down for the different types of leave. We have a 9 pay period review period that is a sliding window and we have a calendar year review period. I need to be able to fill out the leave tracker but differentiate and grab that info based on the 9 week review period indicated in cells C8 and C9. For example, this spreadsheet shows a date range of 03/03/2019-03/16/2019. In the tracker i need that to break out by planned versus unplanned and broken down by LEAVE TYPE in the charts below. The tracker will show how much leave was used, the leave type, if it was planned, sick leave, or FMLA. And I'd like the formula to be able to count up the hours used by UNPLANNED v. PLANNED and broken down by TYPE of leave used. I'm hoping the Excel Think Tank can help because I just can't get it.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,946

    Re: Formula to look at a range of cells, match dates within the range and pull data.

    For example, you can find the amount of sick leave using in the date range using SUMIFS, like this, which will return the sum of hours in column L, for dates in column J that are between C8 and C9, where column N (Sick leave) is Yes

    =SUMIFS(L:L,J:J,">="&$C$8,J:J,"<="&$C$9,N:N,"Yes")

    You can create additional formulas that are similar to this for all of your conditions, being as specific as you like:

    SUMIFS uses Range to be summed, then range1, cond1, range2, cond2, ...... rangeN, condN)
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    08-16-2017
    Location
    Madison, WI
    MS-Off Ver
    2011
    Posts
    20

    Re: Formula to look at a range of cells, match dates within the range and pull data.

    THANK YOU!!!

    Next question - if you can help, awesome! I think I may have done some bad formulas. When a date is entered for tracking the leave used, the supervisor will enter the date in column J. I have column K set to equal that cell but in the format of "dddd" to display the day of the week. This is causing problems when I'm trying to track the "Days Out of Office" because I can't match it to "Monday" since that cell value isn't technically "Monday" but rather "04/01/019" - is there a work around for this?

    The cells I'm specifically trying to do the formula are for G28:G33 for the report period and H28:H33 for the whole list of absences.

    Updated spreadsheet is attached.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,946

    Re: Formula to look at a range of cells, match dates within the range and pull data.

    Insert a column of formulas - insert a new column J, and in J2, enter the formula

    =WEEKDAY(K2)

    then copy down to match your data entry area.

    Mondays will be 2, Tuesdays 3, etc. and then use your SUMIFS with the added condition J:J,2 for Mondays, etc.

  5. #5
    Registered User
    Join Date
    08-16-2017
    Location
    Madison, WI
    MS-Off Ver
    2011
    Posts
    20

    Re: Formula to look at a range of cells, match dates within the range and pull data.

    YOU ARE AMAZING MY FRIEND!!

    I thought I was all done and I got a NEW request from my manager. I've added a new area to the tracker to the right of the tracked leave used. My manager would like a VISUAL representation of the leave, so I know I have some conditional formatting to do. I have the dates laid out to indicate when leave is used. What I need to do is match that to the date used on the left, match it to sick leave, planned, unplanned, or FMLA (4 rules for conditional formatting). When it's all said and done that date in columns V:AA need to conditionally format to match the tracker on the left but I'm not sure how to do that. I know there's a rule for each condition that will go in the actual formatting, but not sure that formula? Again, I appreciate your help!

    1.) For X date find if it's listed in column K. If it's a yes in column O, then turn the font red.
    2.) For X date find if it's listed in column K. If it's a yes in column P, then fill the cell green.
    3.) For X date find if it's listed in column K. If it's a no in column P, then fill the cell red.
    4.) For X date find if it's listed in column K. If it's a yes in column Q, then fill the cell gray.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,946

    Re: Formula to look at a range of cells, match dates within the range and pull data.

    For all of these, use CF with the formula option, with a formula like (written for a cell J2 - the cell with your X date) (I did not download your workbook)

    Select from cell J2 through J?? and use this formula for red Font (Change the J2 to the address of the first (active) cell of the selection):

    =VLOOKUP(J2,$K:$Q,5,False)="Yes"

    For the green fill:
    =VLOOKUP(J2,$K:$Q,6,False)="Yes"

    For the red fill:
    =VLOOKUP(J2,$K:$Q,6,False)="No"

    For the gray fill:
    =VLOOKUP(J2,$K:$Q,7,False)="Yes"

  7. #7
    Registered User
    Join Date
    08-16-2017
    Location
    Madison, WI
    MS-Off Ver
    2011
    Posts
    20

    Re: Formula to look at a range of cells, match dates within the range and pull data.

    THANK YOU THANK YOU THANK YOU!!! Presented this at our all supervisors meeting and THEY LOVED IT!! Thanks for all your help!

  8. #8
    Registered User
    Join Date
    04-03-2019
    Location
    London
    MS-Off Ver
    Excel 365
    Posts
    6

    Re: Formula to look at a range of cells, match dates within the range and pull data.

    Thanks Bernie, that's actually helped me with a similar problem!

+ 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. Replies: 2
    Last Post: 09-06-2018, 10:54 PM
  2. [SOLVED] Formula to match a range of data within another range
    By Naveenkch2 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-30-2017, 06:54 AM
  3. Pull Data Range Depending on Matching Cells
    By Trench37 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-09-2017, 08:22 AM
  4. Replies: 0
    Last Post: 05-18-2016, 04:52 PM
  5. [SOLVED] Creating a formula to populate range of cells between dates based on start and end dates
    By Rainmain82 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-20-2014, 07:42 PM
  6. [SOLVED] Creating a formula to populate range of cells between dates based on start and end dates
    By Rainmain82 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-18-2014, 07:55 AM
  7. [SOLVED] Need to pull a range of cells from a range of tabs
    By ATLGator in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-08-2012, 09:01 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