Formula to match two columns and get a result from third one

Kariba

Board Regular
Joined
Mar 15, 2023
Messages
59
Office Version
  1. 365
Platform
  1. Windows
Hi, wondering if anyone can help? I'm trying to set up a table that will automatically calculate staff shift pay depending on when they start/finish. I've tried various formulas, but getting different results or none at all. Trying to get where both column C matches column J AND where column D matches column K, then put the value in from column L

Thanks

All dates, times, payments are made up in this example


Shift Pay.xlsx
ABCDEFGHIJKL
1Actual Clock InActual Clock OutRounded Clock InRounded Clock OutPaymentStartFinishPayment
217/01/2024 05:3617/01/2024 14:0206:0014:0006:0014:00#N/A06:0014:005.43
318/01/2024 05:4218/01/2024 14:0006:0014:0006:0014:00#N/A07:0015:001.25
419/01/2024 07:4219/01/2024 15:0008:0015:0008:0015:00#N/A08:0015:002.53
520/01/2024 05:4520/01/2024 14:0006:0014:0006:0014:00#N/A
6
7
8
9
10
11
12
13
14
Sheet1
Cell Formulas
RangeFormula
C2:D5C2=TEXT(MROUND(A2,"1:00"),"hh:mm")
E2:F5E2=TEXT(C2,"hh:mm")
G2:G5G2=INDEX(L2:L10,MATCH(1,(J2:J10=C2)*(K2:K10=D2),0))
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hello Kariba

Since there are no duplicates in colum J it is a simple XLOOKUP().
 
Upvote 0
How about
Fluff.xlsm
ABCDEFGHIJKL
1Actual Clock InActual Clock OutRounded Clock InRounded Clock OutPaymentStartFinishPayment
217/01/2024 05:3617/01/2024 14:0206:00:0014:00:005.4306:00:0014:00:005.43
318/01/2024 05:4218/01/2024 14:0006:00:0014:00:005.4307:00:0015:00:001.25
419/01/2024 07:4219/01/2024 15:0008:00:0015:00:002.5308:00:0015:00:002.53
520/01/2024 05:4520/01/2024 14:0006:00:0014:00:005.43
Data
Cell Formulas
RangeFormula
C2:D5C2=MROUND(MOD(A2,1),"1:00")
G2:G5G2=INDEX($L$2:$L$10,MATCH(1,($J$2:$J$10=C2)*($K$2:$K$10=D2),0))
 
Upvote 0
Solution
How about
Fluff.xlsm
ABCDEFGHIJKL
1Actual Clock InActual Clock OutRounded Clock InRounded Clock OutPaymentStartFinishPayment
217/01/2024 05:3617/01/2024 14:0206:00:0014:00:005.4306:00:0014:00:005.43
318/01/2024 05:4218/01/2024 14:0006:00:0014:00:005.4307:00:0015:00:001.25
419/01/2024 07:4219/01/2024 15:0008:00:0015:00:002.5308:00:0015:00:002.53
520/01/2024 05:4520/01/2024 14:0006:00:0014:00:005.43
Data
Cell Formulas
RangeFormula
C2:D5C2=MROUND(MOD(A2,1),"1:00")
G2:G5G2=INDEX($L$2:$L$10,MATCH(1,($J$2:$J$10=C2)*($K$2:$K$10=D2),0))
Seems to work. I had tried MATCH, but suspected the issue might be in time format in C/D wasn't the same as J/K. Haven't used MOD before.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top