IF Statements Help - DESPARATELY NEED HELP!!
Manage your personal finances in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: IF Statements Help - DESPARATELY NEED HELP!!

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    103
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Is there a limit on how many IF's you can have in an IF statement. after about seven, the formula doesnt work. if there is a limit, is there any other option? can i use something like the Case function? or can u run a macro from changing the contents of a cell?
    Thanks, Will

    [ This Message was edited by: willlobb on 2002-04-06 03:49 ]

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Millbank, London, UK
    Posts
    1,790
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Just the 7 mate, then it faints

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Millbank, London, UK
    Posts
    1,790
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    other options inculde the use of =AND, =OR and =VLOOKUP, =HLOOKUP etc etc plus a few more I'm sure will get posted after this message

    :: Pharma Z - Family drugstore ::

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Posts
    103
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    ok thanks chris. can i run a macro when i click a hyperlink, or when the cell contents change?
    Thanks, Will

  5. #5
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Millbank, London, UK
    Posts
    1,790
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I believe both are possible, but would have to do a search to find out how as that's not my area of "expertise".... have you tried a search : I'm sure there's loads of each of these cases
    :: Pharma Z - Family drugstore ::

  6. #6
    Board Regular
    Join Date
    Feb 2002
    Location
    Perth Australia
    Posts
    1,579
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Will

    Don't know about hyperlinks, but try this event macro:

    Right click sheet tab, left click View Code and paste in this code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$D$4" Then Application.Run "Message"
    End Sub

    Create a normal macro called "Message" with this code

    MsgBox "Your macro is running"
    End Sub

    Now when you change anything in cell D4 it will trigger your message macro.

    Hope this helps

    regards
    Derek

  7. #7
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    81,872
    Post Thanks / Like
    Mentioned
    12 Post(s)
    Tagged
    1 Thread(s)

    Default

    You can perhaps tell for what kind of task you seem to need more than 7 IFs along with a sample data and expected results.

  8. #8
    Board Regular
    Join Date
    Mar 2002
    Posts
    103
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for those other replies guys. I am making a financial computer system for a company and i have a table, 3 comlumns wide. the first column is for products sold, the second for quantity and the third for income form each product sold. the third column cotaind the formula:

    =IF($D15="Bracelet Thin",$E17*0.5,IF($D15="Bracelet Thick",$E17*1,IF($D15="Bracelet Custom",$E17*1.5,IF($D15="Mouse Mats",$E17*2,IF($D15="Pebble Small",$E17*0.5,IF($D15="Pebble Large",$E17*1,IF($D15="Tree",$E17*4,IF($D15="Wendy Bell Ticket",$E17*5,""))))))))

    Column D being the Product sold and E being the Quantity. I need to add more products but when i do the formula doesnt work, because like Chris said, it can only take seven.
    Is there any thing i can do. Will a VLookup help? i dont really know how to use one, so if it would work, would you kindly tell me how to do it?
    Thank you very much.
    Will

  9. #9
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-06 05:30, willlobb wrote:
    Thanks for those other replies guys. I am making a financial computer system for a company and i have a table, 3 comlumns wide. the first column is for products sold, the second for quantity and the third for income form each product sold. the third column cotaind the formula:

    =IF($D15="Bracelet Thin",$E17*0.5,IF($D15="Bracelet Thick",$E17*1,IF($D15="Bracelet Custom",$E17*1.5,IF($D15="Mouse Mats",$E17*2,IF($D15="Pebble Small",$E17*0.5,IF($D15="Pebble Large",$E17*1,IF($D15="Tree",$E17*4,IF($D15="Wendy Bell Ticket",$E17*5,""))))))))

    Column D being the Product sold and E being the Quantity. I need to add more products but when i do the formula doesnt work, because like Chris said, it can only take seven.
    Is there any thing i can do. Will a VLookup help? i dont really know how to use one, so if it would work, would you kindly tell me how to do it?
    Thank you very much.
    Will
    Hi Will,

    Definitely consider a Lookup table. There you list *all* the possible items and then use the lookup functions to return the price factor associated with the item. This board is filled with lookup requests so it should give you a good start.

    Specifically for your nested IF statement, you cut 2 IFs by using thr OR statement for the items with equal price factors (Bracelet Thin and Pebble Small; Bracelet Thick and Pebble Large).

    You can also circumvent the 7 IF limit by using booleans as in:

    =(OR(D15={"Bracelet Thin","Pebble Small"})*0.5+OR(D15={"Bracelet Thick","Pebble Large"})+(D15="Bracelet Custom")*1.5+(D15="Mouse Mats")*2+(D15="Tree")*4+(D15="Wendy Bell Ticket")*5)*E17

    This example can be extended and illustrates the use of the OR function within the larger formula.

    Another way to overcome the 7 IF limit is to group IF statments
    =IF(first 7 IFs,true,0)+IF(second 7 IFs,0)+.....

    The best bet for flexibility is to use the lookup functions (VLOOKUP, HLOOKUP, LOOKUP, and INDEX/MATCH).

    HTH,
    Jay


  10. #10
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Millbank, London, UK
    Posts
    1,790
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    http://www.mrexcel.com/board/viewtop...4201&forum=2&2

    try this for your hyperlink / macro enquiry..... courtesy of Mark O'Brien


    :: Pharma Z - Family drugstore ::

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com