+ Reply to Thread
Results 1 to 17 of 17

Help Converting Partial Text, Partial Number Cells to Number Only

  1. #1
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Help Converting Partial Text, Partial Number Cells to Number Only

    I'm trying to utilize a spreadsheet which our production analysts compile regarding actual hours worked of production staff. There are hundreds of rows and 20-30 columns of data, all in one of the following formats:

    #A #

    A #

    #

    where 'A' represents a text letter (either 'a', or 'b') signifying "After" or "Before". They utilize this format to track the regular hours worked (first number) and overtime hours worked (the number following the text character). For example:

    12a 6 = 12 regular hours, and 6 overtime hours after their regular shift

    b 7 = 7 overtime hours before their regular shift

    24 = 24 regular hours

    I need to convert these cells into only numbers. I'm not interested in breaking out overtime. For example, I need to see:

    12a 6 = 18

    b 7 = 7

    24 = 24

    Is there an easy way that I can swap these out? This is a monthly exercise which I will need to do, and it is so time consuming doing one at a time! (or even several at a time if I do a find, replace).

    Thanks!
    Last edited by 2709236; 04-20-2010 at 01:27 PM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    It would be best if you uploaded a sample workbook that contains all of the variations so that a complete solution can be developed. Be sure to remove any sensitive data before uploading.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    Here's one way, if VBA is acceptable. Select the cells of interest and run this:

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    A shot in the dark:

    Please Login or Register  to view this content.
    You didn't identify which version you use, so...

    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  5. #5
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    I'm attaching a file.

    The brown section is the part I'm having trouble with. When I get the file, most numbers are in text format, so they're not populating the green section below. The blue section is my end-goal: to be able to identify the process each employee spent the majority of their time.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    Where do I paste the VBA to run the code? I'm using Excel 2007 and am not so schooled in VBA.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    Adding a Macro to a Code Module
    1. Copy the code from the post
    2. Press Alt+F11 to open the Visual Basic Editor (VBE)
    3. From the menu bar in the VBE window, do Insert > Module
    4. Paste the code in the window that opens
    5. Press Alt+Q to close the VBE and return to Excel

    Running a Macro
    1. Do Alt+F8 to open the macro dialog
    2. Select the macro name from the dropdown list and press Run

  8. #8
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    The VBA seems to have worked, except I have equal signs in all of my blank cells?

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    So don't select any blank cells.

  10. #10
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    I wouldn't but the data is interspersed between blank and not blank cells. Is there a quick way to only select cells with data and not the blank ones?

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    That solved my equal sign problem, but deleted any cells which had whole numbers to begin with? I've attached a sample in an earlier post if you'd like to see the data.

  13. #13
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    Hang on. . . I'm trying again. I ran a smaller sample and it seemed to work. One second. . .

  14. #14
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    I can't get it to work on my large file. Would numbers formatted as text cause the macro to erase them?

  15. #15
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    No - it's vice-versa. It's erasing any numbers NOT formatted as text. There's a mix. On my file, I had already converted all text-formatted numbers to number format.

  16. #16
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    02-25-2008
    Location
    Windsor, ON Canada
    MS-Off Ver
    Excel 2007, 2003
    Posts
    119

    Re: Help Converting Partial Text, Partial Number Cells to Number Only

    That worked! Thanks very much.

+ 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