+ Reply to Thread
Results 1 to 5 of 5

Text and/or Numbers in cell with a conversion formula

Hybrid View

  1. #1
    Registered User
    Join Date
    06-22-2012
    Location
    Billerica, MA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Text and/or Numbers in cell with a conversion formula

    Hello, I have created an Inspection Report that is completed in English (Sheet1) and converted to Metric (Sheet2) using the following formula to convert and round:

    =IF(ROUND(CONVERT(English!H6,"in","mm"),3)=0,"",ROUND(CONVERT(English!H6,"in","mm"),3))

    In Sheet1 the numbers show as 2.0000 or .0020 (example) and in Sheet2 show as 50.800 or .051. Which is what I want the numbers to show as.

    Now I need the ability to write text in the same cells in Sheet1, but when I do I get "A value used in the formula is of the wrong data type" in the cells on Sheet2.

    How can I get specific number formats with formulas and have the ability to put text in the cell?

    Thank you
    JG23

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Text and/or Numbers in cell with a conversion formula

    Use the TEXT function for numeric values, like this:

    ="Today is "&TEXT(TODAY(),"dddd")&", and I'm going shopping"

    In your case the format string will be "0.000" or ".000" (I think - you show both 4 and 3 decimal places in your examples).

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    06-22-2012
    Location
    Billerica, MA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Text and/or Numbers in cell with a conversion formula

    Pete, Thanks for the idea, but it does not work.

    I've tried to simplify it by using 2 columns side by side. In column 1 I need to be able to use text or numbers. If there is a number in column 1, I need it to convert to metric in column 2. However, I soon as I put a formula in column 2 to convert it, it no longer excepts text.

    Column1 Column2
    .0020 .051 (Using Cell*25.4 down column2, numbers are fine but text does not work)
    Accept #VALUE

    I'm at the end of my rope on this and may just have to do each calculation by hand.

    Any other ideas?

    Thank you
    JG23

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Text and/or Numbers in cell with a conversion formula

    Can you post a sample workbook with some examples of exactly what you want to achieve?

    Pete

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Text and/or Numbers in cell with a conversion formula

    Are you saying that you, for example, want inches in col A and mm in col B and you want to be able to have your input into either and have the other cell calculate appropriately? i.e. if you enter, in A2, 7 then B2 becomes 178 and if you put 178 in B2, then A2 becomes 7? But you are finding out that the number entry overwrites the formula/text entry?

    If so, then the answer is that you cannot have both a formula and manual entry in the same cell. You'll need VBA.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ 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