Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Math Formula Function required

Results 1 to 2 of 2
Share This Thread →
  1. #1
    icoombs's Avatar
    icoombs is offline Moderator
    Join Date
    Dec 2006
    Location
    West London, UK
    Posts
    2,715
    Rep Power
    931

    Math Formula Function required

    Hi All

    I have an issue with a site where users level up based on a points system and i need a function to calculate their level. The level is based on the following where the first column is the Level the second column is the points required to gain the level but these are on top of the points used to get the previous level so the third column shows the total points required to reach the level...

    1 1000 1,000
    2 2000 3,000
    3 3000 6,000
    4 4000 10,000
    5 5000 15,000
    6 6000 21,000
    7 7000 28,000
    8 8000 36,000
    9 9000 45,000
    10 10000 55,000

    So for level 1 they need 1000 points, to get to level 2 they need 2000 points above what was required for the level 1 so they need 3000 points, level 3 requires 3000 points above the 3000 of level 2 so they need 6000 etc if that makes any sence.

    I need a function that includes a formula to calculate their level based on the number of points they have. Any one with any ideas?

    Regards
    Ian

  2. #2
    bigmike1212's Avatar
    bigmike1212 is offline 0x800A0C93
    Join Date
    Jan 2009
    Location
    Ridin' through this world...
    Posts
    2,975
    Rep Power
    1310
    Must it be done by formula? I would lean toward throwing your level/points table into a dictionary object or an array and doing a lookup as needed.

    two dimensions, level and max points for level

    userlevel = 0
    for i to upper bound
    if user points > than max points
    set userlevel = that level
    end if
    next
    Brinkster- free development account. Not affiliated, but I sure like free. Brinkster.com

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. JavaScript + Math expert required.
    By icoombs in forum HTML, JavaScript And CSS Help
    Replies: 4
    Last Post: August 22nd, 2010, 07:42 AM
  2. Simple math formula not working
    By mystic7 in forum ASP Development
    Replies: 4
    Last Post: August 21st, 2009, 11:27 AM
  3. Function to deal with math fractions
    By samjaynes in forum ASP Development
    Replies: 7
    Last Post: October 18th, 2006, 11:40 AM
  4. Function Implementation Advise Required
    By hauruapai in forum ASP Development
    Replies: 2
    Last Post: April 19th, 2006, 05:47 PM
  5. math function based on drop down list selection
    By maxtrixx in forum HTML, JavaScript And CSS Help
    Replies: 2
    Last Post: November 22nd, 2004, 03:50 PM

ASP Free Advertisers and Affiliates