+ Reply to Thread
Results 1 to 7 of 7

Mathematical Function not working

  1. #1
    Registered User
    Join Date
    09-27-2012
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    62

    Unhappy Mathematical Function not working

    Hello again,

    I'm not sure exactly if this is a mathematical problem or a labeling problem:

    Here's the Code:
    Please Login or Register  to view this content.
    What it's suppose to do is take the value entered from the UserForm ('HourlyRate') multiply by 37.5 (hours in a week) and multiply that by Utilization (If the employee is full-time it would equal 1 or 100%)

    When I run the macro I get "Run-time error '13': Type Mismatch"

    Scrolling over the line I get:
    NewSalary=0 "HourlyRate="13.68" (the dollar amount I chose on the Userform) and Utilization="100.00%"

    I get no feedback when I scroll over the "*37.5*"

    Any ideas?

    Thanks

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Mathematical Function not working

    Maybe:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    09-27-2012
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    62

    Re: Mathematical Function not working

    Nope.No change BTW what does 'Single' define it as??

  4. #4
    Registered User
    Join Date
    09-27-2012
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    62

    Re: Mathematical Function not working

    I'm not understanding why excel is not recognizing the formula??

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Mathematical Function not working

    Single makes it so you can have decimals, it's less than Double but usually adequate.


    try:
    Please Login or Register  to view this content.

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,577

    Re: Mathematical Function not working

    If your use of quotation marks is accurate, it suggests that the values stored in HourlyRate and utilization are text strings (that look to us like numbers, but VBA may not be able to see them as numbers). I would suggest that you use VBA's type conversion functions (https://msdn.microsoft.com/en-us/lib.../gg264670.aspx ) to force values entered into text boxes in a userform (which are treated as text, if my limited experience is correct) into an appropriate numeric data type. I tend to push almost all my numbers into double so I use the CDbl() function most.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Registered User
    Join Date
    09-27-2012
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    62

    Re: Mathematical Function not working

    Thanks the CDbl() got it!

    Please Login or Register  to view this content.
    Now I need to put days in there!?!?!

+ 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. [SOLVED] Mathematical Function Line Chart
    By zanshin777 in forum Excel General
    Replies: 1
    Last Post: 12-12-2015, 02:55 PM
  2. Replies: 4
    Last Post: 11-02-2015, 06:49 PM
  3. mathematical function
    By oscar5 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-15-2013, 06:26 PM
  4. How to create a function of 2 mathematical formulas?
    By killwin98 in forum Excel Formulas & Functions
    Replies: 23
    Last Post: 05-09-2013, 04:54 PM
  5. How do I enter a working mathematical formula?
    By ianpwilliams in forum Excel General
    Replies: 4
    Last Post: 12-09-2011, 08:56 AM
  6. How to get this mathematical equation into a function?
    By Call in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2010, 02:44 PM
  7. Make UDF for Mathematical Sum function
    By phonon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2007, 01:25 AM

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