+ Reply to Thread
Results 1 to 10 of 10

Trying to make a custom conversion program/forumla between custom data.

  1. #1
    Registered User
    Join Date
    12-31-2013
    Location
    Latrobe Pennsylvania, US
    MS-Off Ver
    Excel 2003
    Posts
    12

    Trying to make a custom conversion program/forumla between custom data.

    Hi Everyone, I'm not sure if I'm posting in the right place or not, but I'm trying to make a converter between about 8 various types of values. These are not units like Km or miles or something like that, but rather numbers that represent a specific "hardness value" on a variety of scales (to name a few: HRC, HRA, K)

    What I've been doing so far is plotting the two types against eachother and then getting the best trendline I can so that I can use that formula to convert between the two with relative certainty. (for example, when plotting HV vs HRC my fourth order polynomial trendline with an Rsquared of 1 is y=0.0001x4 - 0.0188x3 + 1.0768x2 - 20.709x + 350.69)

    My questions comes up where I was hoping to make a window or box of some sort allowing the user to input a numeric value, then selecting the Input units and the hopeful output calculated units, and have the box spit back to the user the conversion.

    My assumption was I would have to input all of those trendlines and define the conversion factor as that, but honestly I have no idea where to start as I am not a programmer :/

    Any help would be fantastic, Thanks!

    -Sean

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Trying to make a custom conversion program/forumla between custom data.

    Please see the attached. I've created a user defined formula - you can see the code by hitting Alt F11 and going to the Module1 tab. Just add extra conversions and remember to save in .xlsm format.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-31-2013
    Location
    Latrobe Pennsylvania, US
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Trying to make a custom conversion program/forumla between custom data.

    wow, thanks so much!

    is there a way to make the To and From cells become dropdowns? I'll end up having quite a few options to choose from to go back and fourth between them

    I'm assuming the To cell is B1 and From is A1? So the user would just type in HRC or HK in the appropriate cell as it is now?

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Trying to make a custom conversion program/forumla between custom data.

    Please have a look at the attached.

    I've added a list of units to column A and defined these as a dynamic named range called Units, I've then used this to drive drop downs in columns C and D.

    The code has been amended slightly to accommodate this and I've added the trivial case where both sets of units are the same and there is not conversion necessary.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-31-2013
    Location
    Latrobe Pennsylvania, US
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Trying to make a custom conversion program/forumla between custom data.

    that's 100% perfect, thank you so much for your help

  6. #6
    Registered User
    Join Date
    12-31-2013
    Location
    Latrobe Pennsylvania, US
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Trying to make a custom conversion program/forumla between custom data.

    I have my one formula for HV to HRC as

    ConvertSpecial = 31.49 + (0.0796683 * FromValue) - (0.0000355432 * (FromValue ^ 2)) - (6728.16 * (FromValue ^ -1))

    Is there a way to allow excel to use that same formula to workbackwards to convert HRC to HV? Solve for y rather than x in a sense?

  7. #7
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Trying to make a custom conversion program/forumla between custom data.

    You might need to make use of the Solver add-in to iteratively search for a FromValue for a given ConvertSpecial value. With a polynomial like this, there might be several values which are valid solutions. In principle, this could be incorporated into a user defined function with a suggested starting value as one parameter to improve the chances of getting the valid solution that you want.

  8. #8
    Registered User
    Join Date
    12-31-2013
    Location
    Latrobe Pennsylvania, US
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Trying to make a custom conversion program/forumla between custom data.

    how would I do that? I've never used the solver function before. I enabled the add-on but quite honestly i don't know what many of the options within Solver do/mean..

  9. #9
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Trying to make a custom conversion program/forumla between custom data.

    Try this

    C1 100

    C3 = 31.49 + (0.0796683 * C1) - (0.0000355432 * (C1 ^ 2)) - (6728.16 * (C1 ^ -1))

    In Solver, set objective $C$3
    To value of (say) 50 and solve.

    You should get C1 changing to 514.593446761267 which gives a value of 50.00000787.

  10. #10
    Registered User
    Join Date
    12-31-2013
    Location
    Latrobe Pennsylvania, US
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Trying to make a custom conversion program/forumla between custom data.

    is there anyway to display that solved equation (or the rearranged one I guess) to add it to the conversion chart that I already have?

+ 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. Converting an Excel Forumla to Custom Function
    By Mike Savage in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-14-2013, 02:36 PM
  2. Replies: 0
    Last Post: 02-21-2013, 08:28 AM
  3. Replies: 1
    Last Post: 07-13-2010, 08:24 PM
  4. how to make my custom formula in OLAP data source pivot table?
    By Abobakr_Nasr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-19-2006, 07:00 AM
  5. Replies: 5
    Last Post: 01-27-2006, 04:55 PM

Tags for this Thread

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