+ Reply to Thread
Results 1 to 4 of 4

Progression through If / ElseIF messing up on certain records -

  1. #1
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Progression through If / ElseIF messing up on certain records -

    I am desperate.
    Look at this:
    Please Login or Register  to view this content.
    Listcost = 10650 Repcost = 3034 Range("Rate") =.43 specost=0
    I set all 3 as
    DIM ... As String
    It should evaluate the ElseIf statement as True and input the value - It skips to the Else statement

    I know that it has the right figures because I modified the Else statement to be = to each variable

    if the ListCost is below 10000 it works right
    However - I have other lines where the Listcost is above 10000 and it works

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Progression through If / ElseIF messing up on certain records -

    DIM ... As String
    A string isn't a number. You cannot do math on a string. Try Dim as Double

    There may be more issues since this is not your entire code.

  3. #3
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: Progression through If / ElseIF messing up on certain records -

    That was it - what is the limitation on the Double Can it handle decimals?

    Thanks!! Don't know why it was working on most - it appears to be working right now.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Progression through If / ElseIF messing up on certain records -

    Double can handle decimals which is why I suggested it. If no decimals are involved it is less memory to use "Long" or possibly "Integer" depending on your needs. Glad it worked for you.

+ 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. Code stepping in to elseif statement when elseif is definitely not true
    By DFrank231 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2013, 05:31 PM
  2. [SOLVED] help me with 2 step progression
    By locksmith1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-24-2012, 06:45 PM
  3. If Elseif elseif problem
    By tjbillund in forum Excel General
    Replies: 3
    Last Post: 08-10-2011, 07:02 AM
  4. Progression.....
    By bluelord in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-20-2010, 03:32 PM
  5. Progression Display
    By excelhelp18 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-31-2008, 01:44 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