Amendment to a formula?

Kirstym1918

New Member
Joined
Dec 17, 2017
Messages
45
Hi everyone,

A little help is required if anyone is willing :)

I have this formula below which pulls staff hours from each weekly tab as the hours are input daily which is in the first two VLOOKUP formulas, if no hours are found for that particular person then it reverts to the INDEX MATCH formula which pulls the data from their rota i.e Holiday, Rest day, Overtime (This then compiles the below which by the end of the week is filled with hours worked). It works great except, I would like it to look at the rota first and if the data match in the rota equals "overtime", I want it to use this rather than pull their hours through from the VLOOKUP formula. Can anyone offer any help of how I should do that at the beginning of the formula?

=IF($C44<>"",IFERROR(VLOOKUP('HB Overtime'!$C44,Sun!$C$6:$F$501,4,FALSE),IFERROR(VLOOKUP($C44,Sun!$H$6:$K$501,4,FALSE),IFERROR(INDEX(HB_Rota'!$D$4:$NE$500,MATCH($C44,HB_Rota'!$C$4:$C$500,0),MATCH(D$2,HB_Rota'!$D$1:$NE$1,0)),""))),"")

1576181218349.png
 

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
Hi, I'm very interested in helping you, always I have passionate in Payroll and Budgets topics, but please try prepare a data example using add-in specifically for this and it can be found here XL2BB
Pay attention to this post XL2BB 2 Squares

Thanks a lot
 
Upvote 0
Thanks very much, sorry it took a while, I've been trying to condense all three workbooks that it pulls from so that it is on one sheet so you can understand where the formulas are pulling the information from
 
Upvote 0
Please see below, I have highlighted the cells which show the issue, for example JoeBloggs2 on Tuesday 18th Feb would have been on rest day but decided to work instead therefore his working hours have been input by our office staff in K19:N19, I don't want this to be calculated as hours in Cell E5, I want it to revert back to the rota data (Data in cell N5) whenever W-5th is recorded on the rota. I hope this makes sense?

I've dragged data from three separate workbooks below to simplify it for you, Formulas are usually linked via sharepoint files but due to workplace data I've had to replicate it


Book1
BCDEFGHIJKLMNOPQR
216/02/202017/02/202018/02/202019/02/202020/02/202021/02/202022/02/2020Employee Name16/02/202017/02/202018/02/202019/02/202020/02/202021/02/202022/02/2020
3Employee NameSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAYNameSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAY
4Joe Bloggs1RRRJoe Bloggs1RRRWWWW
5Joe Bloggs2RR9.5Joe Bloggs2RRW-5thWWWW
6Joe Bloggs3R10.510.5Joe Bloggs3RWWRRWW
7Joe Bloggs4R9.59.5Joe Bloggs4RWWWWRR
8Joe Bloggs5R6.56.5Joe Bloggs5RWWWWRR
9Joe Bloggs6R10.510.5Joe Bloggs6RWWRRWW
10   
11
12
13Sunday TabMonday TabTuesday Tab
14Employee NameStartEndHoursNameStartEndHoursNameStartEndHours
15Joe Bloggs305:3016:0010.5Joe Bloggs305:3016:0010.5
16Joe Bloggs406:3016:009.5Joe Bloggs406:3016:009.5
17Joe Bloggs507:3014:006.5Joe Bloggs507:3014:006.5
18Joe Bloggs608:3019:0010.5Joe Bloggs608:3019:0010.5
19 Joe Bloggs208:3018:009.5
20  
21  
22  
23
Overtime
Cell Formulas
RangeFormula
C4:C10C4=IF($B4<>"",IFERROR(VLOOKUP($B4,$B$15:$E$22,4,FALSE),IFERROR(INDEX($L$4:$R$10,MATCH($B4,$K$4:$K$10,0),MATCH(C$2,$L$2:$R$2,0)),"")),"")
D4:D10D4=IF($B4<>"",IFERROR(VLOOKUP($B4,$F$15:$I$22,4,FALSE),IFERROR(INDEX($L$4:$R$10,MATCH($B4,$K$4:$K$10,0),MATCH(D$2,$L$2:$R$2,0)),"")),"")
E4:E10E4=IF($B4<>"",IFERROR(VLOOKUP($B4,$K$15:$N$22,4,FALSE),IFERROR(INDEX($L$4:$R$10,MATCH($B4,$K$4:$K$10,0),MATCH(E$2,$L$2:$R$2,0)),"")),"")
I15:I22,N15:N22I15=IF(H15<>"",ROUND(((H15-G15+(H15<G15)-$A$1)*24)/0.25,0)*0.25,"")
 
Upvote 0
Hi, an idea for you

Book1
BCDEFGHIJKLMNOPQRS
1
216-Feb-202017-Feb-202018-Feb-202019-Feb-202020-Feb-202021-Feb-202022-Feb-2020Employee Name16-Feb-202017-Feb-202018-Feb-202019-Feb-202020-Feb-202021-Feb-202022-Feb-2020
3Employee NameSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAYNameSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAY
4Joe Bloggs1RRRJoe Bloggs1RRRWWWW
5Joe Bloggs2RR Joe Bloggs2RRW-5thWWWW
6Joe Bloggs3R10.510.5Joe Bloggs3RWWRRWW
7Joe Bloggs4R9.59.5Joe Bloggs4RWWWWRR
8Joe Bloggs5R6.5 Joe Bloggs5RWW-5thWWRR
9Joe Bloggs6R10.510.5Joe Bloggs6RWWRRWW
10   
11
12
13Sunday TabMonday TabTuesday Tab
14Employee NameStartEndHoursNameStartEndHoursNameStartEndHours
15Joe Bloggs35:3016:0010.5Joe Bloggs35:3016:0010.5
16Joe Bloggs46:3016:009.5Joe Bloggs46:3016:009.5
17Joe Bloggs57:3014:006.5Joe Bloggs57:3014:006.5
18Joe Bloggs68:3019:0010.5Joe Bloggs68:3019:0010.5
19 Joe Bloggs28:3018:009.5
20  
21  
22  
23
Sheet6
Cell Formulas
RangeFormula
C4:C10C4=IF($B4<>"",IFERROR(VLOOKUP($B4,$B$15:$E$22,4,FALSE),IFERROR(INDEX($L$4:$R$10,MATCH($B4,$K$4:$K$10,0),MATCH(C$2,$L$2:$R$2,0)),"")),"")
D4:D10D4=IF($B4<>"",IFERROR(VLOOKUP($B4,$F$15:$I$22,4,FALSE),IFERROR(INDEX($L$4:$R$10,MATCH($B4,$K$4:$K$10,0),MATCH(D$2,$L$2:$R$2,0)),"")),"")
E4, E10E4=IF($B4<>"",IFERROR(VLOOKUP($B4,$K$15:$N$22,4,FALSE),IFERROR(INDEX($L$4:$R$10,MATCH($B4,$K$4:$K$10,0),MATCH(E$2,$L$2:$R$2,0)),"")),"")
E5:E9E5=IF(AND($B5<>"",N5<>"W-5th"),IFERROR(VLOOKUP($B5,$K$15:$N$22,4,FALSE),IFERROR(INDEX($L$4:$R$10,MATCH($B5,$K$4:$K$10,0),MATCH(E$2,$L$2:$R$2,0)),"")),"")
I15:I22, N15:N22I15=IF(H15<>"",ROUND(((H15-G15+(H15<G15)-$A$1)*24)/0.25,0)*0.25,"")
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

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