+ Reply to Thread
Results 1 to 9 of 9

Thread: If condition

  1. #1
    Registered User
    Join Date
    10-23-2010
    Location
    Hyderabad
    MS-Off Ver
    Excel 2003
    Posts
    43

    If condition

    Hi All,
    I need help to figure this out.
    Sales Made Weightage
    >25 15%
    16 to 25 12 to 14.5%
    11 to 15 7% to 10%
    5 to 10 1% to 5%
    0 to 4 0%

    I am trying to calculate there performance depending on their sales.
    If an agent made 16 sales he should get 12 points.
    If an agent make sales between 16 to 25 then it should be prorated between 12 to14.5 points.
    Attached Files Attached Files
    Last edited by anto1510; 11-11-2010 at 05:06 PM. Reason: included attachment

  2. #2
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    617

    Re: If condition

    I'm not really clear from your example what your trying to acheive, what do you mean someone would recieve 12 14.5 points prorated? if someon had sales of 18 or 20 what would your expected answer be? maybe you could alter the example to show a little clearer what your input would be to get your desired output
    Windows 7 using Office 2007 & 2010

    Remember your [ code ] [ /code ] tags, makes reading soooo much easier

  3. #3
    Forum Guru mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    3,004

    Re: If condition

    Try this user defined function

    Function GetPoints(Cell As Range)
    Select Case Cell.Value
        Case Is > 25
            GetPoints = 15
        Case Is >= 16
            GetPoints = 12 + ((Cell.Value - 16) / (25 - 16)) * (14.5 - 12)
        Case Is >= 11
            GetPoints = 7 + ((Cell.Value - 11) / (15 - 11)) * (10 - 7)
        Case Is >= 5
            GetPoints = 1 + ((Cell.Value - 5) / (10 - 5)) * (5 - 1)
        Case Else
            GetPoints = 0
    End Select
    End Function
    
    Open the VBA editor (Alt F11), insert a new module, paste in the above, return to the worksheet (Alt F11) and use the function  = GetPoints()
    Martin

    Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.

    If my solution has saved you time and/or money, please consider donating to Cancer Research UK.

  4. #4
    Registered User
    Join Date
    10-23-2010
    Location
    Hyderabad
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: If condition

    I dont want to use VBA. Do we have any other way to figure this out.

  5. #5
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If condition

    You can use mrices case statements and make a nested IF function...
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  6. #6
    Registered User
    Join Date
    10-23-2010
    Location
    Hyderabad
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: If condition

    Please dont get me wronk.I dont want to use VBA or Macros.

  7. #7
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If condition

    My suggestion was to transform this:

    Case Is > 25
            GetPoints = 15
        Case Is >= 16
            GetPoints = 12 + ((Cell.Value - 16) / (25 - 16)) * (14.5 - 12)
        Case Is >= 11
            GetPoints = 7 + ((Cell.Value - 11) / (15 - 11)) * (10 - 7)
        Case Is >= 5
            GetPoints = 1 + ((Cell.Value - 5) / (10 - 5)) * (5 - 1)
        Case Else
            GetPoints = 0
    into this:

    =IF(A1> 25,15,IF(A1>= 16,12 + ((Cell.Value - 16) / (25 - 16)) * (14.5 - 12),IF(A1>= 11,7 + ((Cell.Value - 11) / (15 - 11)) * (10 - 7),IF(A1>= 5,1 + ((Cell.Value - 5) / (10 - 5)) * (5 - 1),0))))
    which is a formula!
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  8. #8
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If condition

    My suggestion was to transform this:

    Case Is > 25
            GetPoints = 15
        Case Is >= 16
            GetPoints = 12 + ((Cell.Value - 16) / (25 - 16)) * (14.5 - 12)
        Case Is >= 11
            GetPoints = 7 + ((Cell.Value - 11) / (15 - 11)) * (10 - 7)
        Case Is >= 5
            GetPoints = 1 + ((Cell.Value - 5) / (10 - 5)) * (5 - 1)
        Case Else
            GetPoints = 0
    into this:

    =IF(A1> 25,15,IF(A1>= 16,12 + ((A1 - 16) / (25 - 16)) * (14.5 - 12),IF(A1>= 11,7 + ((A1 - 11) / (15 - 11)) * (10 - 7),IF(A1>= 5,1 + ((A1 - 5) / (10 - 5)) * (5 - 1),0))))
    which is a formula!
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  9. #9
    Registered User
    Join Date
    10-23-2010
    Location
    Hyderabad
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: If condition

    Thank you so much

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0