+ Reply to Thread
Results 1 to 11 of 11

Refer to other cells

  1. #1
    Registered User
    Join Date
    08-05-2018
    Location
    Frankston
    MS-Off Ver
    damianclarkson
    Posts
    8

    Refer to other cells

    Hi,
    I would like to know if there is a way to reference date data from other cells.

    eg;
    I have

    Screen Shot 2018-08-09 at 10.39.40 am.png

    The reason being, I need to make calculations based on time and date where the time crosses over midnight into the next day, but I don't want to have to put date/time every start and finish cell.
    So, from attached example, I want cell C2 to mean 8pm on the 8/8/18 (from A2) and cell D2 to mean 3 am on the 9/8/18 (the next day from (B2))

    Hope this makes sense.
    Thanks
    Last edited by damianclarkson; 08-08-2018 at 08:42 PM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Refer to other cells

    Using your posted example....
    Try something like this:
    Please Login or Register  to view this content.
    And format that cell as
    Category: Time
    Type: 37:30:55

    Which yields this format code: [h]:mm:ss;@

    For your example, that formula returns: 7:00:00

    Is that something you can work with?
    Last edited by Ron Coderre; 08-08-2018 at 09:12 PM.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Refer to other cells

    If the data in A2 is truly a date only and C2 is a time only, then you just have another cell which equals A2+C2 and format as a Date with Time.

  4. #4
    Registered User
    Join Date
    08-05-2018
    Location
    Frankston
    MS-Off Ver
    damianclarkson
    Posts
    8

    Re: Refer to other cells

    Thanks but I don't think I've explained myself properly.
    I want to be able to input the start date and finish date in the first 2 columns myself, and input the time in and time out in the next 2 columns myself, but have that time cell reference the date in the first column.
    So that if I do a calculation in another sell for example "does end time go over into the next day ie; past midnight" It will come up with yes because the end time is referencing the dates in the first 2 columns.
    See attached pic.
    Screen Shot 2018-08-09 at 4.03.25 pm.png

  5. #5
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Refer to other cells

    Attach your workbook rather than an image.

    Go Advanced -> manage Attachments -> Upload

  6. #6
    Registered User
    Join Date
    08-05-2018
    Location
    Frankston
    MS-Off Ver
    damianclarkson
    Posts
    8

    Re: Refer to other cells

    That's done,
    thanks
    Attached Files Attached Files

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,795

    Re: Refer to other cells

    In E2:

    =IF(B2>A2,"Yes","No")

    In F2:

    =D2*24

    However, if you are doing this because of difficulties calculating working hours, then there is a way to do that without the need for these helper columns.

    Using this:

    =MOD(D2-C2,1)*24

    in a cell formatted as a number or general will give you the working hours.
    Last edited by AliGW; 08-09-2018 at 02:25 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Refer to other cells

    I'm not sure that this solves your problem, but take a look at the attached. You also had a space in the date in B2 which was making it not a date.

    Solution as provided by Ron.
    Attached Files Attached Files
    Last edited by kersplash; 08-09-2018 at 02:28 AM.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,795

    Re: Refer to other cells

    Please post the solution in the body of your post as well so that members unable to open attachments can benefit. Thanks.

  10. #10
    Registered User
    Join Date
    08-05-2018
    Location
    Frankston
    MS-Off Ver
    damianclarkson
    Posts
    8

    Re: Refer to other cells

    Hi AliGW,

    Your solution seems to have worked. I think I was over complicating it.

    Thanks!

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,795

    Re: Refer to other cells

    You're welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Using Range to refer to cells
    By malcmail in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-15-2018, 01:05 PM
  2. Refer only cells with content
    By magic2finger in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-08-2016, 09:36 AM
  3. How to refer to cells according to a cell pattern
    By canis01 in forum Excel General
    Replies: 0
    Last Post: 01-08-2013, 04:34 PM
  4. Refer to cells in the range consisting of non-adjacent cells
    By dmitry in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2011, 10:48 AM
  5. Refer to cells in array
    By krabople in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2007, 03:53 AM
  6. How do you refer to empty cells in coding?
    By Turquoise_dax in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-22-2006, 01:00 PM
  7. [SOLVED] refer to a cells value in a macro
    By loulou in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-24-2005, 10:06 AM

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