Newbie looking for a formula

spranger24

New Member
Joined
Jun 3, 2021
Messages
4
Office Version
  1. 2013
Platform
  1. Windows
I have column A and column B showing the days worked for agents and supervisors. I'd like to have a formula that shows the number of matching days between the two in column C. In the example below A2 and B2 have 3 days that they are both working.

1622828976287.png


Or

If anyone knows of a way to calculate the total hours scheduled together. Any help is much appreciated.

1622829296020.png
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
@spranger24
Might this help with the first?

MRXLMAY21.xlsm
ABC
1AgentSupervisorMatch
2FY::TWRFYSMT::3
3F::MTWRFYSMT::3
4FY:MTW:::SMTWR3
5F::MTWR::SMTWR4
6::SMTWR::SMTWR5
7F:SM:WR::SMTWR4
8:Y::TWRFYSMT::2
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=SUMPRODUCT(ISNUMBER(FIND(MID(SUBSTITUTE(A2,":","!"),{1,2,3,4,5,6,7},1),B2,1))*1)
 
Upvote 0
@spranger24
Might this help with the first?

MRXLMAY21.xlsm
ABC
1AgentSupervisorMatch
2FY::TWRFYSMT::3
3F::MTWRFYSMT::3
4FY:MTW:::SMTWR3
5F::MTWR::SMTWR4
6::SMTWR::SMTWR5
7F:SM:WR::SMTWR4
8:Y::TWRFYSMT::2
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=SUMPRODUCT(ISNUMBER(FIND(MID(SUBSTITUTE(A2,":","!"),{1,2,3,4,5,6,7},1),B2,1))*1)

I think that's on the right path. That formula seems to be counting more than what it should. Cell C2 should have a value of 3, where the formula gives a value of 5.
 
Upvote 0
Are you using the = as a blank? You need to use a : instead as per my example.

Also, this is maybe getting towards a solution for your second ask.

MRXLMAY21.xlsm
ABCDEFGHIJK
10Agent HrsAgent DaysSupervisor HrsSupervisor DaysTotal Hours TogtherLEFTALEFTCRIGHTARIGHTCHours Overlap
1109:00 - 18:00FY::TWR10:00 - 19:00FY::TWR4091018198
1214:00 - 23:00F:SM:WR14:00 - 23:00F:SM:WR45141423239
1314:00 - 01:00FY:MT::14:00 - 23:00FY:MT::36141425239
1414:00 - 23:00FY:MT::14:00 - 01:00FY:MT::36141423259
1522:00 - 01:00FY::TWR23:00 - 02:00FY::TWR10222325262
Sheet1
Cell Formulas
RangeFormula
G11:G15G11=HOUR(LEFT(A11,5))
H11:H15H11=HOUR(LEFT(C11,5))
I11:I15I11=IF(LEFT(A11,5)>RIGHT(A11,5),HOUR(RIGHT(A11,5))+24,HOUR(RIGHT(A11,5)))
J11:J15J11=IF(LEFT(C11,5)>RIGHT(C11,5),HOUR(RIGHT(C11,5))+24,HOUR(RIGHT(C11,5)))
K11:K15K11=MIN(I11:J11)-MAX(G11,H11)
E11:E15E11=SUMPRODUCT(ISNUMBER(FIND(MID(SUBSTITUTE(B11,":","!"),{1,2,3,4,5,6,7},1),D11,1))*K11)


I have utilised helper columns to avoid getting silly long formula.

If there are any errors due to the issue of working to, from or across midnight then I will let you work that out.
 
Upvote 0
Solution
Are you using the = as a blank? You need to use a : instead as per my example.

Also, this is maybe getting towards a solution for your second ask.

MRXLMAY21.xlsm
ABCDEFGHIJK
10Agent HrsAgent DaysSupervisor HrsSupervisor DaysTotal Hours TogtherLEFTALEFTCRIGHTARIGHTCHours Overlap
1109:00 - 18:00FY::TWR10:00 - 19:00FY::TWR4091018198
1214:00 - 23:00F:SM:WR14:00 - 23:00F:SM:WR45141423239
1314:00 - 01:00FY:MT::14:00 - 23:00FY:MT::36141425239
1414:00 - 23:00FY:MT::14:00 - 01:00FY:MT::36141423259
1522:00 - 01:00FY::TWR23:00 - 02:00FY::TWR10222325262
Sheet1
Cell Formulas
RangeFormula
G11:G15G11=HOUR(LEFT(A11,5))
H11:H15H11=HOUR(LEFT(C11,5))
I11:I15I11=IF(LEFT(A11,5)>RIGHT(A11,5),HOUR(RIGHT(A11,5))+24,HOUR(RIGHT(A11,5)))
J11:J15J11=IF(LEFT(C11,5)>RIGHT(C11,5),HOUR(RIGHT(C11,5))+24,HOUR(RIGHT(C11,5)))
K11:K15K11=MIN(I11:J11)-MAX(G11,H11)
E11:E15E11=SUMPRODUCT(ISNUMBER(FIND(MID(SUBSTITUTE(B11,":","!"),{1,2,3,4,5,6,7},1),D11,1))*K11)


I have utilised helper columns to avoid getting silly long formula.

If there are any errors due to the issue of working to, from or across midnight then I will let you work that out.
Much appreciated Snakehips!!
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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