IF Function

DonnaA

New Member
Joined
Mar 10, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi All đź‘‹
I'm building a timesheet that works around shop workers entering in multiple times throughout the day on multiple work orders.
So I'm accounting for an 8 hour shift that I need to have their 1/2 lunch break automatically deducted from their timesheet.
The issue I'm running into is they can have multiple entries in the morning and afternoon accounting for their time.
IE:
1687447577607.png


So the above example shows that on the 19th he worked on 3 WO. I used this formula: =IF(F3>="4:00",":00",":30") (in the outlined cell)
With the intention that I want to deduct the 1/2 lunch break on any time recorded that is >= 4 hours.
I've done some reading on entering multiple arguments using the IF function (AND -OR) separated by * but I can't get it to work
I would like a formula that supports this argument: Deduct 1/2 on any time that is>= 4.5 and Deduct 0 on anything less than that time.
Any advice is welcome.
TIA
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
not sure whats entered into time worked or how calculated from image
but it looks like a time value

you say 4 hours then say 4.5 hours

anyway
for 4.5 hours
=IF(E2>=TIMEVALUE("4:30"),E2-TIMEVALUE("0:30"),E2)
for 4 hours
=IF(E2>=TIMEVALUE("4:00"),E2-TIMEVALUE("0:30"),E2)

Book1
ABCDEF
1time worked
24:004:00
31:001:00
42:002:00
54:304:00
65:004:30
Sheet1
Cell Formulas
RangeFormula
F2:F6F2=IF(E2>=TIMEVALUE("4:30"),E2-TIMEVALUE("0:30"),E2)


Note: Images are difficult to see , and also requires that I input all the data myself, which means I may make an error, which is very time consuming, and from my point of view less likely to get a response, if a complicated spreadsheet. Plus we cannot see any of the formulas used.

Therefore -

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 0
Hi
Thank you for detailed answer and for the extra time it took to even know what I was asking for.
I will definitely get on board with the XL2BB tool for future posts (newbie here).
That formula worked for what I needed (mostly) but it is missing the last parameter of where if the time entered is less than 4.5 hours to not make the :30 deduction.
So am I able to join 2 arguments to the IF function with an array (*) between the 2 ?
This doesn't work: =IF(F12>=TIMEVALUE("4:30"),F12-TIMEVALUE("0:30"),F12)*IF(F12<=TIMEVALUE("4:30"),F12-TIMEVALUE("0:00"),F12)
What am I doing wrong ?

TIA
 
Upvote 0
not sure i follow, what you mean
That formula worked for what I needed (mostly) but it is missing the last parameter of where if the time entered is less than 4.5 hours to not make the :30 deduction.
so why is it missing ???

*IF(F12<=TIMEVALUE("4:30"),F12-TIMEVALUE("0:00"),F12)
isnt F12 - 0 , actually just F12
so
F12-TIMEVALUE("0:00")
is F12 for the true part F12-0
and for the false part its also F12

so why have it at all

clearly i'm not following

If F12 was 3
then my formula would , just show F12 , so nothing taken off the time

as i showed , in my example , only row 5 and 6 6 has the deduction the rest of the results are identical to the original time

That formula worked for what I needed (mostly) but it is missing the last parameter of where if the time entered is less than 4.5 hours to not make the :30 deduction.
so why is it missing ???
 
Upvote 0
Sorry there was another formula in the adjacent cell that was changing your result based on those parameters....I'm reworking the spreadsheet to now extract any OT.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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