+ Reply to Thread
Results 1 to 8 of 8

Trying to figure out IF formula

  1. #1
    Registered User
    Join Date
    02-05-2020
    Location
    charleston sc
    MS-Off Ver
    MS Office 2016
    Posts
    3

    Trying to figure out IF formula

    A B C D
    Dispatched Ambulance On Scene Other Resource On Scene Elapsed

    1 6:35:39 6:42:36 =IF(B1,<>"",B1-A1) IF(B1,"",C1-A1)
    2 6:42:45 6:55:51
    3 6:55:59 6:56:31
    4 6:59:26 7:07:44
    5 7:18:44 7:32:18


    I am trying to get an elapsed time by subtracting the time in column A from the time in column B unless column B is blank in which case subtract column A from column C. I'm not sure of the correct nomenclature for the formula but have tried several different iterations without success. I know the one above is not close, just trying to show what I'm trying to do

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Trying to figure out IF formula

    Hi & welcome to the board.
    How about
    =IF(B1,<>"",B1-A1,C1-A1)

  3. #3
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Trying to figure out IF formula

    try using in D1
    =if(B1<>"",B1-A1,C1-A1)
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Trying to figure out IF formula

    The general form of an If statement is:

    =IF( some_condtiion , action_if_true , action_if_false )

    so try this instead of your formula:

    =IF(B1="" , C1-A1 , B1-A1)

    It is hard to see from what you have posted which columns the data sits in, so it is always better to post a sample workbook (see the yellow banner at the top of the screen).

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    02-05-2020
    Location
    charleston sc
    MS-Off Ver
    MS Office 2016
    Posts
    3

    Re: Trying to figure out IF formula

    That worked. Thanks for you help. Sorry about the columns in the question and thanks for the advice for next time.

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Trying to figure out IF formula

    You're welcome & thanks for the feedback

  7. #7
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Trying to figure out IF formula

    thanks for the feedback :-)

  8. #8
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Trying to figure out IF formula

    Quote Originally Posted by jpc99 View Post
    . . . I am trying to get an elapsed time by subtracting the time in column A from the time in column B unless column B is blank in which case subtract column A from column C. . . .
    While there are tabs in your post, this web site follows web standards and replaces all whitespace sequences with single spaces, so your posting is difficult to read. There is a formatting option for tables, but convention here is to post example workbooks. That'd help.

    If there's no time in either cols B or C, presumably you'd want a blank result. Also, I figure you could have instances of dispatch time just before midnight and on scene times just after midnight.

    D1: =IF(COUNT(B1),MOD(B1-A1,1),IF(COUNT(C1),MOD(C1-A1,1),""))

    Note: this only works when elapsed times are less than 24 hours/full days due to the MOD call. However, if you could have elapsed times greater than 24 hours, you should be using date along with time.

+ 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. VBA: Show Subtracted Figure In Cell When Cumulative Figure Is Entered
    By hrayani in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2018, 11:29 AM
  2. [SOLVED] Using Linear Regression to predict a future event / performance figure / speed figure
    By Doofus1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-22-2017, 11:51 AM
  3. Replies: 1
    Last Post: 06-22-2017, 02:58 AM
  4. converting a monthly figure with growth to an annual figure
    By venvitale in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-04-2015, 05:23 PM
  5. Replies: 4
    Last Post: 02-03-2014, 08:05 AM
  6. Sum formula to exclude monthly budget figure when actual figure is entered
    By rocketmail in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-02-2013, 04:22 AM
  7. Calculating monthly sales figure required to make annual turnover figure
    By CatIsoSio Sky in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-27-2010, 04:42 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