+ Reply to Thread
Results 1 to 10 of 10

How to Convert Decimals to Feet, Inches and Fractions

  1. #1
    Registered User
    Join Date
    06-24-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    19

    How to Convert Decimals to Feet, Inches and Fractions

    Hello Everyone,

    I've searched high and low and could not find an answer to my question. I'd like to know if it is possible to convert numbers with or without decimal points into the folliowing different formats within the same cell depending on 3 possible entry formats. I don't need to use these numbers for any further calculation so no worries there.

    Example of possible entry formats into the same cell:

    1.) If I enter 17.2.5 into the cell, the cell need to be converted to 17' 2.5"
    2.) If I enter 17.2 into the cell, the cell need to be converted to 17' 2"
    3.) If I enter 17 into the cell, the cell need to be converted to 17'

    Ideally I'd like to accomplish this using custom number formatting, not VBA.

    Thank you in advance for your guidance.
    Last edited by noelglez; 04-25-2018 at 06:43 PM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: How to Convert Decimals to Feet, Inches and Fractions

    This sort of thing is not going to be accomplished by number formatting. Something like "17.2.5" is a text string, not a number, so number formatting cannot change its appearance. In the end, the only way to do this is to use string manipulation functions to read the input text string and manipulate it into the desired output text string. In order to do this in a single cell, you will need VBA (probably a change event) to take the input and do the manipulation and output the result back to the same cell.

    At this point, I suggest that you look at your requirements and decide what you must have, and what requirements you can relax:
    1) Text input with pattern.
    2) Manipulate text to desired output pattern.
    3) All in one cell.
    4) Without using VBA.

    For example, if you relax the "all in one cell" requirement, this should be relatively easy to accomplish using one cell as input and a second cell containing a suitable combination text manipulation formulas (SUBSTITUTE() maybe?) as output.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    06-24-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: How to Convert Decimals to Feet, Inches and Fractions

    Thank you for post MrShorty. Is the "All in one cell" possible using VBA? Using VBA is likely the only requirement I would be able to relax in this project.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: How to Convert Decimals to Feet, Inches and Fractions

    Yes, a VBA procedure will allow you to read the input from the cell, process the text string, then output the result back into the same cell. What part of building and implementing this procedure do you need help with? I would expect something like this (quickly put together so it will need more development):
    Please Login or Register  to view this content.
    If you want this to occur automatically whenever something is entered into a cell (or a specific cell), you will need to put that inside of a change event procedure. There should be lots of examples of change event procedures on this forum and across the internet. Let us know if you have trouble finding and understanding them.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: How to Convert Decimals to Feet, Inches and Fractions

    Change Event code: for data entered in column 1

    Please Login or Register  to view this content.
    Enter data in column 1

    To add code: right click on tab, "View Code", then copy/past code.

    ===============================================================

    Function for data in any column:

    With data in C1, then in D1

    =dec2imp(C1)

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JohnTopley; 04-26-2018 at 02:39 AM.

  6. #6
    Registered User
    Join Date
    06-24-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: How to Convert Decimals to Feet, Inches and Fractions

    Thank you, MrShorty and JohnTopley. I downloaded John's example file and can cofirm it is working like a charm! I will incorporate thiis VBA into my project file.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: How to Convert Decimals to Feet, Inches and Fractions

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

  8. #8
    Registered User
    Join Date
    06-24-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: How to Convert Decimals to Feet, Inches and Fractions

    Quote Originally Posted by JohnTopley View Post
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Done! Thanks again.

  9. #9
    Registered User
    Join Date
    06-24-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: How to Convert Decimals to Feet, Inches and Fractions

    Hi John, incoming rookie mistake. I just realized your code is set to only work on the first column. Trouble is my document needs this code to work on several specific colums and cells within those colums.

    This is the named range:
    ='Page 4'!$D$17,'Page 4'!$F$17,'Page 4'!$H$17,'Page 4'!$D$20,'Page 4'!$F$20,'Page 4'!$H$20,'Page 4'!$D$23,'Page 4'!$F$23,'Page 4'!$H$23,'Page 4'!$D$26,'Page 4'!$F$26,'Page 4'!$H$26,'Page 4'!$D$29,'Page 4'!$F$29,'Page 4'!$H$29,'Page 4'!$D$32,'Page 4'!$F$32,'Page 4'!$H$32,'Page 4'!$D$35,'Page 4'!$F$35,'Page 4'!$H$35,'Page 4'!$D$38,'Page 4'!$F$38,'Page 4'!$H$38,'Page 4'!$D$41,'Page 4'!$F$41,'Page 4'!$H$41,'Page 4'!$D$44,'Page 4'!$F$44,'Page 4'!$H$44,'Page 4'!$D$47,'Page 4'!$F$47,'Page 4'!$H$47,'Page 4'!$D$50,'Page 4'!$F$50,'Page 4'!$H$50

    I tried to modify the code to work when changes occur in any cell in the named range "Feet", but I must be missing something in the code.

    Any suggestions? Thank you.

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-24-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: How to Convert Decimals to Feet, Inches and Fractions

    Update! I think I found the proper code. Thanks again.

    Please Login or Register  to view this content.

+ 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. Convert Feet and Inches (Fractions) to Decimal Feet
    By kellser in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-29-2022, 10:15 AM
  2. [SOLVED] Convert feet, inches, fractions to inches and decimals
    By bjohnsonac in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-03-2021, 12:08 PM
  3. Convert feet and inches to decimal feet
    By hrg in forum Excel General
    Replies: 12
    Last Post: 04-11-2016, 05:19 PM
  4. formula to convert cell numbers in inches and feet: 1'2" to decimals
    By ihill in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-16-2015, 09:45 AM
  5. Convert Decimal Feet to Feet and Inches
    By Surveyour in forum Excel General
    Replies: 6
    Last Post: 10-17-2013, 12:48 PM
  6. Convert feet and inches to deimal feet.
    By okenter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2011, 02:43 AM
  7. Convert decimals to feet / inches in excel
    By rk@morsesteel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2005, 01:06 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