Formula Result wrong

Michele317

New Member
Joined
Apr 29, 2024
Messages
31
Office Version
  1. 365
Platform
  1. Windows
Hello,
I post below the problem I'm having.
I have in the first 4 cells some in-out hours (D, E, H, I)
Then I have a delta. In this case, the total duration minus 5 hours. (K)
Then I have a check: if the duration is greater than 30 minutes, the result shall be the result in the row above (total duration - 5 hours). (L)

All of this works perfectly fine with many many rows but here I have a wrong result and I don't understand why and how.

Cartellino.xlsm
DEHI
3008:4913:5714:2614:53
Marzo 2025
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B3:D33Expression=$D3="Malattia"textNO
B3:D33Expression=$D3="Festivo"textNO
B3:D33Expression=$D3="Ferie"textNO
B3:D33Expression=$D3="Permesso"textNO
B3:D33Expression=$D3="Ferie + Permesso"textNO
B3:C33,H5:H9,H12:H16,H19:H23,H26:H30,H33Expression=$H3="Festivo"textNO
B3:C33,H5:H9,H12:H16,H19:H23,H26:H30,H33Expression=$H3="Ferie"textNO
B3:C33,H5:H9,H12:H16,H19:H23,H26:H30,H33Expression=$H3="Permesso"textNO
B3:C33,H5:H9,H12:H16,H19:H23,H26:H30,H33Expression=$H3="Ferie + Permesso"textNO

Cartellino.xlsm
KL
3000:3500:27
Marzo 2025
Cell Formulas
RangeFormula
K30K30=IF(J30="","",IF(OR(D30="Ferie",D30="Permesso",D30="Ferie + Permesso",H30="Festivo",H30="Ferie",H30="Permesso",H30="Ferie + Permesso"),IF(J30-Settings!$C$6/2<0,ROUND(J30-Settings!$C$6/2,10),J30-Settings!$C$6/2),IF(WEEKDAY(B30)=6,ROUND(J30-Settings!$C$7,10),ROUND(J30-Settings!$C$6,10))))
L30L30=IF(OR(K30="",D30=""),"",IF(AND(WEEKDAY(B30)=6,K30>TIME(0,30,0)),IF(E30-D30<=TIME(5,0,0),K30,I30-H30),IF(K30>TIME(0,30,0),K30,"")))


Thank you all for the help :)
 
I like to know what is in B30, cause could be this part giving is you the wrong result (WEEKDAY(B30)=6), i am not sure, still please check. thank you
 
Upvote 0
I like to know what is in B30, cause could be this part giving is you the wrong result (WEEKDAY(B30)=6), i am not sure, still please check. thank you
Hello Sam and thank you for the answer.
In B30 there is a simple date. In this case, as you can see below, it's a friday :)
Cartellino.xlsm
BCDEHI
3028/03/2025ven08:4913:5714:2614:53
Marzo 2025
Cell Formulas
RangeFormula
B30B30=C29+1
C30C30=B30
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B3:D33Expression=$D3="Malattia"textNO
B3:D33Expression=$D3="Festivo"textNO
B3:D33Expression=$D3="Ferie"textNO
B3:D33Expression=$D3="Permesso"textNO
B3:D33Expression=$D3="Ferie + Permesso"textNO
B3:C33,H5:H9,H12:H16,H19:H23,H26:H30,H33Expression=$H3="Festivo"textNO
B3:C33,H5:H9,H12:H16,H19:H23,H26:H30,H33Expression=$H3="Ferie"textNO
B3:C33,H5:H9,H12:H16,H19:H23,H26:H30,H33Expression=$H3="Permesso"textNO
B3:C33,H5:H9,H12:H16,H19:H23,H26:H30,H33Expression=$H3="Ferie + Permesso"textNO
B3:C33Expression=E($B3=OGGI();GIORNO.SETTIMANA($B3;2)>5)textNO
B3:C33Expression=E($B3=OGGI();GIORNO.SETTIMANA($B3;2)<=5)textNO

Cartellino.xlsm
KL
3000:3500:27
Marzo 2025
Cell Formulas
RangeFormula
K30K30=IF(J30="","",IF(OR(D30="Ferie",D30="Permesso",D30="Ferie + Permesso",H30="Festivo",H30="Ferie",H30="Permesso",H30="Ferie + Permesso"),IF(J30-Settings!$C$6/2<0,ROUND(J30-Settings!$C$6/2,10),J30-Settings!$C$6/2),IF(WEEKDAY(B30)=6,ROUND(J30-Settings!$C$7,10),ROUND(J30-Settings!$C$6,10))))
L30L30=IF(OR(K30="",D30=""),"",IF(AND(WEEKDAY(B30)=6,K30>TIME(0,30,0)),IF(E30-D30<=TIME(5,0,0),K30,I30-H30),IF(K30>TIME(0,30,0),K30,"")))
 
Upvote 0
@Michele317 Please try this in L30:
Excel Formula:
=IF(OR(K30="",D30=""),"",IF(AND(WEEKDAY(B30)=7,K30>TIME(0,30,0)),IF(E30-D30<=TIME(5,0,0),K30,I30-H30),IF(K30>TIME(0,30,0),K30,"")))
 
Upvote 1

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