+ Reply to Thread
Results 1 to 10 of 10

Calculating the difference between cells, but using the value of another cell if the

  1. #1
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Calculating the difference between cells, but using the value of another cell if the

    I have the following on a spreadsheet that keeps track of when student work is handed in and calculates how many days late it is so a penalty mark can be given.

    A1= User entered value : a fixed submission date that a piece of work is due to be handed in on.
    A2 = User entered value : The date entered if work is handed in on time or early
    A3 = User entered value : The date the work was handed in if late
    A4 = User entered value : The date the piece of work is due to be handed in if an extension has been granted
    A5 = Calculated value : How many days late a piece of work is

    Essentially I want the calculation in A5 to reflect how many days late a piece of work is. SUM(A3-A1) would do this of course. If the work is early or on time, A2 is ignored.

    Sometimes however students have permission to hand work in late, in which case another calculation is needed to work out how many (if any) days over their extension date (A4) their work is. How do I combine these two calculations into the same cell, so that if A3 is empty it checks A4 to see if the student has an extension date and then returns a 'days late' value if applicable?

    I hope this makes sense.....
    Last edited by NBVC; 06-02-2009 at 03:57 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating the difference between cells, but using the value of another cell if

    Does this do it?

    =IF(A4<>"",A4-A1,IF(A3<>"",A3-A1,""))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Calculating the difference between cells, but using the value of another cell if

    actually it might - but ive made a small but important oversight - ill get back to this when i get home.....

    cheers

  4. #4
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Calculating the difference between cells, but using the value of another cell if

    ok if anyone has time, here's the amended question as i realised the first one wasn't quite right.

    I have the following informaiton on a spreadsheet that keeps track of when student work is handed in and calculates how many days late it is so a penalty mark can be given.

    A1 = User entered value : The date work is originally due to be submitted.
    A2 = User entered value : The date work was actually submitted (without being granted an extension).
    A3 = User entered value : The date work is to be submitted if an extension has been given.
    A4 = Calculation showing number of days late : If there is a value in A2 (but not one in A3) then subtract A1 from A2. But if there is a value in A3 then subtract value of A3 from A2 instead.
    I also need it to say, 'days late' after any instance where the value returned in A4 is positive. If the value calculated is not >0 then A4 needs to be left entirely blank.

    Any help would be much appreciated!

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating the difference between cells, but using the value of another cell if

    Try:

    =IF(A3<>"",A3-A1&" days late",IF(A2<>"",A2-A1& " days late",""))

  6. #6
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Calculating the difference between cells, but using the value of another cell if

    Thanks, i noticed that two cell references were the wrong way round. This seems to work.

    =IF(B3<>"",B2-B3&" days late",IF(B2<>"",B2-B1& " days late",""))
    Is there any way i can get it to leave the entire cell blank when it calculates it to be '0 days late' or if it's early?

    Thanks again.

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating the difference between cells, but using the value of another cell if

    Try

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: Calculating the difference between cells, but using the value of another cell if

    Try this...just more IF's nested

    Please Login or Register  to view this content.
    HTH,

    -GWB
    I help because of the Pavlovian dog that resides in the inner me...so if you are happy with the results, please add to my reputation. It helps keep me motivated!



    Please mark your threads as Solved once it is solved. Check the FAQ's to see how.

  9. #9
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Calculating the difference between cells, but using the value of another cell if

    thanks both of those are great. Much appreciated.

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Calculating the difference between cells, but using the value of another cell if

    Does GWB's handle your negatives as you desired?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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