+ Reply to Thread
Results 1 to 5 of 5

[SOLVED] Function tagging values with if statements

  1. #1
    Registered User
    Join Date
    02-25-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Angry [SOLVED] Function tagging values with if statements

    I wrote a function to change a value in a cell to an ordinal number.

    Please Login or Register  to view this content.

    --- All postive values that get passed through the function return a value of "5." If I remove the postive value statements, I get the desired result for negative numbers. When I remove the last for lines, I get correct return of "1" for postiive values that satisfy the statement, however, if I remove the last three lines, I get a value of 2 for everything.

    Is this function over defined? I don't understand why I can simply make nested if statements using If Else. I using Else and only got errors.
    Last edited by NBVC; 02-25-2010 at 12:18 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Function tagging values with if statements

    You are running every function. Just run it until it finds a match like so, maybe:

    Please Login or Register  to view this content.
    I'm having trouble with your ranges. Can you just make a table showing the ranges and the result so it's crystal clear?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Function tagging values with if statements

    Maybe this to order it and reduce required calcs:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-25-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Thumbs up Re: Function tagging values with if statements

    Thank you so much! I tried the second post you made and it works just fine. When I had originally tried writing the if statements, I did not include the final "Else End If"

    Thank you so much for your help, I really appreciate it!

    cheers,
    Tara

  5. #5
    Registered User
    Join Date
    02-25-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Function tagging values with if statements

    Thank you- works great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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