+ Reply to Thread
Results 1 to 10 of 10

Subtract 4 hour from all cells in a column

  1. #1
    Registered User
    Join Date
    05-17-2013
    Location
    New Hampshire
    MS-Off Ver
    Excel 2010
    Posts
    84

    Subtract 4 hour from all cells in a column

    I have a column of times that are formatted 12:30:00, 14:02:00.....so on and so on. I want to convert these times to be 4 hours less than what they are. Is there a formula I can put in a cell somewhere that will do this for me?

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Subtract 4 hour from all cells in a column

    If you have time in cell A2, try this.....

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,738

    Re: Subtract 4 hour from all cells in a column

    put 4 hours into a cell 04:00
    then
    right click on the that cell and copy
    select the column with the hours you want to change
    go to paste special
    and use the subtract option
    that should apply the 4 hour subtraction to all the cells
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Registered User
    Join Date
    05-17-2013
    Location
    New Hampshire
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Subtract 4 hour from all cells in a column

    That works but I think that I want all the time cells in the "A" column to look at a cell and then change to the minus 4 hours. So if cell A2 is 12:30:00 it will look at a cell and change to 8:00:00

  5. #5
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,738

    Re: Subtract 4 hour from all cells in a column

    you will probably need VBA to change the contents of the column itself - so that if you enter a time - then it looks at a cell and changes the time you entered to a different time - VBA would need to do that ,i think
    not my area of expertise
    if you can use a different cell , then the formula supplied by sktneer with a slight modification

    instead of 4 - use the cell reference where you want the time difference to be used

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Subtract 4 hour from all cells in a column

    What etaf gave you will subtract the 4 hours from your existing data. Otherwise, in column B1 or where ever the data starts enter:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    where F1 is where you have the 4:00 hours that you want to subtract.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Subtract 4 hour from all cells in a column

    Quote Originally Posted by RandyD123 View Post
    So if cell A2 is 12:30:00 it will look at a cell and change to 8:00:00
    So you like to round down to hour, after 4 hours subtracted:
    =FLOOR(A1-4/24,1/24)
    Quang PT

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Subtract 4 hour from all cells in a column

    You may try this code to see if this helps.......
    Assuming you have time values in col. A and start from cell A2.
    And in cell B2 you have input 4 which you want to subtract from the time values in col. A. If this is not B2 in your sheet, you may change this in the code as per requirement. To do so just change B2 in red color.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-17-2013
    Location
    New Hampshire
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Subtract 4 hour from all cells in a column

    I should just post what it is I am trying to do!!!! I really have a file that I want to convert (insert a PIVOT Table) by running a VB script. I will post the "DATA File" and then what the final result should be. I can do it manually but I think I need 2 files. The fist one would be saved to my destop as "DATA.XLSX" and I would open a second file that has the "code" to run against the data file and produce a PIVOT table.

    In the file I uploaded all my times are plused 4 hours. I need to minus 4 hours from each one AND it need to change the date if after the minuse 4 hours changes the date column!!!!

    The DATA file will change everyday.
    Attached Files Attached Files
    Last edited by RandyD123; 03-15-2014 at 12:32 PM. Reason: more info

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Subtract 4 hour from all cells in a column

    I don't know what you are wanting VBA for but here is the Pivot Table with -4 hours shown. This is in TABULAR format and not compact form...you can choose what you want.
    Attached Files Attached Files

+ 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. How do I subtract 1 hour from one cell and input it another?
    By Steven in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-06-2005, 12:05 AM
  2. [SOLVED] How do I subtract 1 hour from one cell and input it another?
    By Steven in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-06-2005, 03:05 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