+ Reply to Thread
Results 1 to 8 of 8

Using a Macro to add a 0 in cells

  1. #1
    Registered User
    Join Date
    01-20-2014
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    21

    Using a Macro to add a 0 in cells

    We have a spreadsheet with a large amount of data and the time fields are :mm:ss. I need to be able have enter a 0 before the :mm:ss - so my pivot table will read it correctly. ANy thoughts?
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    08-28-2013
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2010, 2013
    Posts
    69

    Re: Using a Macro to add a 0 in cells

    Are these times just after midnight and before 1:00 am? If so, they are displaying correctly. If not, what are you trying to do with the pivot table?

  3. #3
    Registered User
    Join Date
    01-20-2014
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Using a Macro to add a 0 in cells

    It's a sum of time. So the examples are the sum of a person's breaks. So I don't need them to be AM or PM - just to include the 0:29:59.

    The pivot table is adding each row together and giving an average of them but I'm getting the error because the format isn't complete. Does that help?

  4. #4
    Registered User
    Join Date
    08-28-2013
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2010, 2013
    Posts
    69

    Re: Using a Macro to add a 0 in cells

    Is there more data to group by other than just the time?

  5. #5
    Registered User
    Join Date
    01-20-2014
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Using a Macro to add a 0 in cells

    I'm using the pivot table to sum these columns and average them.
    Attached Files Attached Files

  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
    52,929

    Re: Using a Macro to add a 0 in cells

    These are not times, they are text that is starting to look like a time.

    Use this in a helper column, copied down...
    =TIMEVALUE(0&A1)

    edit: keep in mind that excel treats time as a decimal of 1 (day), so 06:00 AM is actually 0.25, 12 noon is 0.5 etc
    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

  7. #7
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Using a Macro to add a 0 in cells

    Hi -

    try;
    Please Login or Register  to view this content.
    event

  8. #8
    Registered User
    Join Date
    01-20-2014
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Using a Macro to add a 0 in cells

    Thanks the Macro did the job!

+ 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. [SOLVED] Macro merge cells separated by comma, ignore blank cells
    By lagiosman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2014, 04:49 PM
  2. Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition
    By Mark V. in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-07-2013, 12:45 PM
  3. Looking to create a macro that will skip blank cells in a column, find data cells
    By crayzwalz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2013, 09:01 AM
  4. Replies: 0
    Last Post: 03-21-2013, 02:46 AM
  5. [SOLVED] Macro to repeat action too a range of cells with assending numbers in the cells.
    By 2k05gt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2012, 02:13 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