SOLVED

Select data within Multiple Rows within date ranges

%3CLINGO-SUB%20id%3D%22lingo-sub-2705308%22%20slang%3D%22en-US%22%3ESelect%20data%20within%20Multiple%20Rows%20within%20date%20ranges%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2705308%22%20slang%3D%22en-US%22%3E%3CP%3EI%20need%20to%20find%20an%20hourly%20rate%20for%20an%20employee%20the%20range%20falls%20within%20the%20date%20that%20the%20overtime%20was%20worked.%3C%2FP%3E%3CP%3EHere%20is%20a%20sample%20of%20the%20data%20set%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22markplumridge_0-1630460483406.png%22%20style%3D%22width%3A%20546px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F307143iEE75206797A3268D%2Fimage-dimensions%2F546x131%3Fv%3Dv2%22%20width%3D%22546%22%20height%3D%22131%22%20role%3D%22button%22%20title%3D%22markplumridge_0-1630460483406.png%22%20alt%3D%22markplumridge_0-1630460483406.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ECan%20somebody%20help%20me%20with%20a%20formulae%20to%20lookup%20with%20both%20criteria%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2705308%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2705403%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20data%20within%20Multiple%20Rows%20within%20date%20ranges%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2705403%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1142922%22%20target%3D%22_blank%22%3E%40markplumridge%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBoth%20criteri%3CFONT%20color%3D%22%23FF0000%22%3Ea%3C%2FFONT%3E%3F%20The%20only%20criteri%3CFONT%20color%3D%22%23FF0000%22%3Eon%3C%2FFONT%3E%20that%20I%20see%20described%20is%20the%20date.%20So%20let%20me%20suggest%3A%3C%2FP%3E%3COL%3E%3CLI%3Ethat%20you%20post%20not%20an%20image%20but%20the%20actual%20excel%20file%20from%20which%20the%20image%20was%20taken%2C%20so%20that%20we%20(I%20or%20somebody%20else)%20don't%20have%20to%20go%20to%20the%20trouble%20of%20re-creating%20what%20already%20exists.%20Just%20make%20sure%20there%20are%20no%20real%20names%20of%20real%20people%20in%20the%20file.%3C%2FLI%3E%3CLI%3E%3CSPAN%3Ethat%20you%20be%20a%20little%20more%20specific%20on%20what%20the%20selection%20criteri%3CFONT%20color%3D%22%23FF0000%22%3Ea%3C%2FFONT%3E%20are.%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FOL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2705674%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20data%20within%20Multiple%20Rows%20within%20date%20ranges%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2705674%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%20Thank%20you.%20File%20is%20now%20attached.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2707235%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20data%20within%20Multiple%20Rows%20within%20date%20ranges%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2707235%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1142922%22%20target%3D%22_blank%22%3E%40markplumridge%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20posting%20the%20spreadsheet.%20But%20at%20first%20it%20was%20more%20confusing%20than%20your%20original%20post.%20The%20workbook%20has%20a%20front%20sheet%20(Sheet1)%20that%20contains%20a%20few%20formulas%20(VLOOKUP%20and%20INDEX%2FMATCH)%20but%20they%20don't%20refer%20to%20the%20Sheet2%2C%20which%20is%20where%20the%20data%20you%20originally%20posted%20in%20image%20form.%20Nor%20is%20it%20readily%20apparent%20what%20criteria%20are%20being%20used.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20could%20you%20please%20spell%20out%20more%20clearly%20what%20it%20is%20you%20want%20done%20with%20the%20data%20on%20Sheet2%20(or%20Sheet1).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20said%2C%20since%20you%20specified%20two%20criteria%20at%20the%20start%2C%20may%20I%20point%20you%20in%20the%20direction%20of%20a%20possible%20solution.%20If%20you%20have%20the%20newest%20version%20of%20Excel%2C%20there%20are%20some%20new%20%22Dynamic%20Array%20functions%2C%22%20FILTER%20and%20UNIQUE%20among%20them%2C%20that%20might%20be%20the%20solution%20you're%20looking%20for.%20Here's%20a%20YouTube%20video%20that%20explains%20them....from%20the%20formulas%20you've%20written%2C%20it%20would%20appear%20that%20you%20do%20have%20a%20good%20grasp%20of%20some%20of%20the%20basics%20of%20data%20retrieval%20from%20an%20Excel%20database.....these%20new%20functions%20take%20that%20to%20a%20whole%20new%20level.%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9I9DtFOVPIg%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9I9DtFOVPIg%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20you%20will%20need%20the%20newest%20version%20of%20Excel%20for%20these%20Dynamic%20Array%20functions%20to%20work%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2708918%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20data%20within%20Multiple%20Rows%20within%20date%20ranges%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2708918%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1142922%22%20target%3D%22_blank%22%3E%40markplumridge%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESee%20attached%20if%20it%20fulfills%20your%20requirements%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2F1drv.ms%2Fx%2Fs!AiUZUhiQtF3FguQA9nFDQRKPnUhiZA%3Fe%3DVL31Ci%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Evlookup%20formulaes%20tests.xlsx%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELet%20me%20know%20if%20you%20need%20help%20reconfiguring%20it%20to%20the%20desired%20table%20column%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2710742%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20data%20within%20Multiple%20Rows%20within%20date%20ranges%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2710742%22%20slang%3D%22en-US%22%3EThanks%20Yea_So%3CBR%20%2F%3EI%20cant%20follow%20your%20suggestion.%20I%20am%20trying%20to%20lookup%20the%20hourly%20rate%20that%20the%20Overtime%20date%20falls%20between%20so%20I%20can%20use%20this%20to%20calculate%20a%20cost%20using%20the%20OT%20hrs.%3CBR%20%2F%3EAlso%20my%20actual%20spreadsheet%20has%20over%204000%20rows%20for%20approx.%20130%20employees%20with%20different%20range%20of%20salary%20dates%20so%20I%20am%20unsure%20how%20to%20use%20your%20method%20with%20this%20volume%20of%20dates.%3CBR%20%2F%3EHope%20your%20can%20still%20help!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2710743%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20data%20within%20Multiple%20Rows%20within%20date%20ranges%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2710743%22%20slang%3D%22en-US%22%3EThanks%20mathetes.%20I%20will%20take%20a%20look%20and%20try%20but%20it%20might%20be%20beyond%20my%20skill%20set.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2711229%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20data%20within%20Multiple%20Rows%20within%20date%20ranges%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2711229%22%20slang%3D%22en-US%22%3EI'm%20willing%20to%20help%20more%2C%20but%20you%20need%20to%20give%20some%20clarification%20on%20exactly%20what%20it%20is%20you're%20trying%20to%20do%2C%3C%2FLINGO-BODY%3E
Occasional Contributor

I need to find an hourly rate for an employee the range falls within the date that the overtime was worked.

Here is a sample of the data set

markplumridge_0-1630460483406.png

Can somebody help me with a formulae to lookup with both criteria?

 

10 Replies

@markplumridge 

 

Both criteria? The only criterion that I see described is the date. So let me suggest:

  1. that you post not an image but the actual excel file from which the image was taken, so that we (I or somebody else) don't have to go to the trouble of re-creating what already exists. Just make sure there are no real names of real people in the file.
  2. that you be a little more specific on what the selection criteria are.

@mathetes  Thank you. File is now attached.

@markplumridge 

 

Thank you for posting the spreadsheet. But at first it was more confusing than your original post. The workbook has a front sheet (Sheet1) that contains a few formulas (VLOOKUP and INDEX/MATCH) but they don't refer to the Sheet2, which is where the data you originally posted in image form. Nor is it readily apparent what criteria are being used.

 

So could you please spell out more clearly what it is you want done with the data on Sheet2 (or Sheet1).

 

That said, since you specified two criteria at the start, may I point you in the direction of a possible solution. If you have the newest version of Excel, there are some new "Dynamic Array functions," FILTER and UNIQUE among them, that might be the solution you're looking for. Here's a YouTube video that explains them....from the formulas you've written, it would appear that you do have a good grasp of some of the basics of data retrieval from an Excel database.....these new functions take that to a whole new level. https://www.youtube.com/watch?v=9I9DtFOVPIg

 

But you will need the newest version of Excel for these Dynamic Array functions to work

Learn everything about our brand-new Dynamic Arrays and how you can use them to build advanced spreadsheets. Arrays (CSE) have long been present in Excel, bu...

@markplumridge 

 

I am removing my suggested solution because the suggested solution was only for the presented dataset and not for the 4000 lines of variant [Start Date] and [End Date] for 130 other employees. to get an accurate solution, the [Start Date] column and the [End Date] column must be in a separate table with unique start and end date ranges and must include all date ranges to compare against the 4000 OT dates.  Maybe try @Sergei Baklan solution.

 

As a variant, here is a sample file for what is being described above.

Where Periods table must have unique ranges

That way, if an employee has OT in the same period on a different day
or a different employee has OT on the same day as 129 other employees the comparison is not looking at multiple instances of the same period range that will skew the result the solution will still accurately detect it since the setup makes it that much granular and not lumpy

Yea_So_0-1630622104243.png

 

See attached

Thanks Yea_So
I cant follow your suggestion. I am trying to lookup the hourly rate that the Overtime date falls between so I can use this to calculate a cost using the OT hrs.
Also my actual spreadsheet has over 4000 rows for approx. 130 employees with different range of salary dates so I am unsure how to use your method with this volume of dates.
Hope your can still help!
Thanks mathetes. I will take a look and try but it might be beyond my skill set.
I'm willing to help more, but you need to give some clarification on exactly what it is you're trying to do,
best response confirmed by allyreckerman (Microsoft)
Solution

@markplumridge 

Based on initial screenshot that could be like

=LOOKUP(2, 1/ ( $G2:$G9 = A2 )/ (C2>=$H$2:$H$9)/ (C2<=$I$2:$I$9), $J$2:$J$9)

 

For entire range, using dynamic one

=LOOKUP(2, 1/
 ( $G$2:INDEX($G:$G, COUNTA($G:$G)) = $A2 ) /
 ( $C2 >= $H$2:INDEX($H:$H, COUNTA($H:$H)) )/
 ( $C2 <= $I$2:INDEX($I:$I, COUNTA($I:$I)) ),
 $J$2:INDEX($J:$J, COUNTA($J:$J)))
Thanks Sergei. That worked.