+ Reply to Thread
Results 1 to 6 of 6

Google Sheets: If/Then statement

  1. #1
    Registered User
    Join Date
    08-07-2019
    Location
    Cincinnati, OH
    MS-Off Ver
    2013
    Posts
    12

    Google Sheets: If/Then statement

    Hello,

    I am once again asking for your assistance. Thank you for all the help you have given me in the past.

    I am trying to add a formula to the line below that automatically checks to see if the employee has worked 8 hours+ and if so, subtracts 30 min from the time. here is what i have so far:

    =Iferror(((D4-C4)),-TIME(0,30,0)), )

    Now i just need it to check the if the time is over 8 and then make the minus 30 min conditional.

    (this is purely for planning purposes only, our employees get more than 30 min for lunch, and it is paid. I promise our employees are happy, well rested and paid fairly.)

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Google Sheets: If/Then statement

    What you need to understand about dates and times in excel is…

    a date is just a number representing the number of days passed since 1/1/900...and then formatted in a way that we recognize as a date. So, for instance, today (Wed 01 Sep 2021) is actually 44440

    Time is actually a decimal part of 1 (day), so 06:00 AM is 0.25, 12 noon is 0.5 and 18:00 (or 6 PM) is 0.75

    So you really just need to test for > 0.333 or 8/24, then subtract 0.020833333 (or 30/60/24 )
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    08-07-2019
    Location
    Cincinnati, OH
    MS-Off Ver
    2013
    Posts
    12

    Re: Google Sheets: If/Then statement

    I didn't know that, thank you!

    If/Then statements are a weakness of mine, how would your advise plug into the example above?

    Please and Thank you!

  4. #4
    Registered User
    Join Date
    08-07-2019
    Location
    Cincinnati, OH
    MS-Off Ver
    2013
    Posts
    12

    Re: Google Sheets: If/Then statement

    Also, along a similar line, how would i be able to detect how many hours took place before 8:30am or after 5:00pm?

  5. #5
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,142

    Re: Google Sheets: If/Then statement

    are you able to upload a spreadsheet (or provide a link to google file) with some sample data, and also some examples of expected/anticipated results, and some notes that explain what other columns/cells might be needed in order to calculate the results you expect to see?
    Last edited by janmorris; 09-01-2021 at 06:56 PM.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Google Sheets: If/Then statement

    Depending on what you want to do, maybe something like...

    =if(calc/cell containing shift >8/24, cell-30/60/24,cell)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Google Sheets: Create an IF statement with a subtraction, multiple times. Display Result
    By mlinds1989 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 6
    Last Post: 02-20-2021, 06:06 PM
  2. Replies: 5
    Last Post: 02-20-2021, 12:48 AM
  3. Google Sheets: Condition formatting in Google sheet
    By cyee in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 02-18-2021, 05:35 PM
  4. [SOLVED] Google sheets script to download file and save it to google drive folder and use it's data
    By western in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 5
    Last Post: 01-18-2021, 01:31 PM
  5. [SOLVED] Google sheets vba to download file and save it to google drive folder and use it's data
    By western in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-14-2021, 08:48 AM
  6. Google Apps Script for Google Sheets Pulling Formulas from Master to Several Slave Sheets
    By excelroofing in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 08-22-2018, 02:06 AM
  7. email row contents based on cell values (google sheets populated by google forms)
    By reedg in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 01-13-2016, 02:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1