+ Reply to Thread
Results 1 to 26 of 26

Add spaces to cells

  1. #1
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Add spaces to cells

    Hello, I need a better way (rather than indivdually) to add a space before PM or AM in a cell range that looks like this:

    04:06PM
    04:19PM
    04:32PM
    08:42PM
    11:00AM
    12:01PM
    06:13AM
    09:35PM
    06:18AM
    09:00PM
    12:34PM
    12:37PM
    07:22AM

    In other words a space before the last two letters of every cell in colum C

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Add spaces to cells

    =if(iserr(find("am",c16,1)),substitute(c16,"pm"," pm"),substitute(c16,"am"," am"))

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Add spaces to cells

    Perhaps

    =LEFT(A1,LEN(A1)-2) &" "&RIGHT(A1,2)

  4. #4
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Add spaces to cells

    Hi kane12

    Try the following and format the cells as "hh:mm AM/PM"
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards Kevin


    Merged Cells (They are the work of the devil!!!)

  5. #5
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    I can't figure it out. My data is in Column C, cell C3 - C2642. Don't know how to begin.
    Thanks

  6. #6
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    I can"t get any of these solutions to work. Maybe I'm not using them correctly. Any help would be MUCH appreciated. I have much more work doing this task of adding spaces. A macro ? A formula ? I am a novice at Excel.

    Thanks !

  7. #7
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Add spaces to cells

    Maybe..

    Please Login or Register  to view this content.
    EDIT: Changed to column C, as per OP requirement
    Last edited by Ace_XL; 02-22-2013 at 11:46 AM.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  8. #8
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    Quote Originally Posted by Ace_XL View Post
    Maybe..

    Please Login or Register  to view this content.
    My data is in column c, does that make a difference ?

  9. #9
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Add spaces to cells

    Hi kane12

    Good point!

    =REPLACE(C1,LEN(C1)-1,0," ")+0

  10. #10
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    It makes every cell say 12:00 AM

  11. #11
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    I have blank cells in c1, c2 and my data starts in c3. I put the formula in c1 and drag down.

  12. #12
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Add spaces to cells

    Ensure that calculation settings are set to 'automatic', else press F9 after dragging down. If it still dosent work upload a sample worksheet

  13. #13
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    This formula made every cell say 12:00 AM

  14. #14
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    automatic ?? where do I set that ?

  15. #15
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Add spaces to cells

    It displays the correct result for me! See the attached.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    how do I attach a sample spreadsheet ?

  17. #17
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Add spaces to cells

    Go Advanced an it is the paper clip.

  18. #18
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Add spaces to cells

    Try this :

    Please Login or Register  to view this content.
    Note : don't forget format time : 1:30 PM or custom : h:mm AM/PM
    Last edited by SDCh; 02-22-2013 at 12:30 PM. Reason: Change code
    Click (*) if you received helpful response.

    Regards,
    David

  19. #19
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    sample file to play with
    Attached Files Attached Files

  20. #20
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Add spaces to cells

    What do you want to do!

  21. #21
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    Wow ... still changes everything to 12:00 AM. I'm doing something wrong. Thanks for your patience !

  22. #22
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Add spaces to cells

    find replace should do it
    find PM replace {space}PM
    repeat for AM
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  23. #23
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    Add a space before AM or PM without changing the time. I see it works on your example but I can't make it work on mine.

  24. #24
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Add spaces to cells

    kane12,

    Your data already on format time, and not like what you said on post #1, that why we all get wrong.


    Regards
    SDCh
    Last edited by SDCh; 02-22-2013 at 12:37 PM.

  25. #25
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Add spaces to cells

    kane12

    That is time you have in column C. If you click on C1 for example > Format as general. You will see a number. that is why none of these formulas are working!

  26. #26
    Registered User
    Join Date
    02-18-2013
    Location
    Springfield, Il. USA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Add spaces to cells

    Quote Originally Posted by martindwilson View Post
    find replace should do it
    find PM replace {space}PM
    repeat for AM
    That worked !! HURAY !!!
    Thank you all so much for helping !!!!!!

+ 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