+ Reply to Thread
Results 1 to 6 of 6

Nested IF Statement

  1. #1
    Registered User
    Join Date
    06-22-2007
    Location
    North East ENGLAND
    Posts
    3

    Nested IF Statement

    Hi

    I am trying to creat a spreadsheet to creat a calculation that I thought would be easy with an IF statement. Iam later going to write VBA to carry out the function but this is for an assignment where I first have to create a spreadsheet to do the function.

    I have 2 fields customer type and number of books. Based on this my bookstore will alllocate a discount on customer orders. I need to say something like IF cust type is "Individual" and number of books is <5 =0, IF cust type is individual and number of books is >5<24 =15, IF cust type is individual and number of books is > 25 = 25. I need to continue this type of thing for another customer type. I have looked at the wizzard and have created a simple IF statement by stating if cust type is individual 1,2 all this did was brokedown the customer type into a number I stil cannot find out how to add the extra bit of the function into the IF statement.

    Can anyone help or advise f I should use another function that IF such as LOOKUP

    Thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    If your number of books breakdown is consistent, then you could use a lookup table and use an Index/Match formula to find your discount...

    see attached for example.
    Attached Files Attached Files
    Where there is a will there are many ways.

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

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

  3. #3
    Registered User
    Join Date
    06-22-2007
    Location
    North East ENGLAND
    Posts
    3
    Thanks for the reply that doesnt quite work in my scenario because the number of books for individuals to get discounts ar different to the discounts the other customer type (library, school or educational inst.) get.

    eg individual only have 3 discount levels the other group have 5 the numbers breakdown differently

    I had thought of a coding system a discount value could be two digits the first could be customer type the second the number of books (but a code eg <5 books code 1) I could then do something (notice my vaguesness!!) to say if first digit a and second digit 1 apply this and so on or even a lookup table with all possibilities in? but I couldnt find a function in the excel list that sounded like it did this.

    Thanks very much

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    How about this method? See Attached.

    Setup of Mini tables for each type and name each table independently through Insert|Name|Define.

    Then formula in B4 would decipher which table to do the lookup on based on what is inputted. (Note: The Named ranges must match the text inputted in, for example, A2 on my sheet....

    Formula used in B4: =LOOKUP(B2,INDIRECT(A2))

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    oops! forgot attachment
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-22-2007
    Location
    North East ENGLAND
    Posts
    3
    Thanks sooo much I think that will work I was trying ot do it using one table which wont have helped!!

    Thanks again

+ 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.6.0 RC 1