+ Reply to Thread
Results 1 to 11 of 11

Help with proper syntax for an IF(AND formula construct

  1. #1
    Registered User
    Join Date
    09-14-2013
    Location
    ohio
    MS-Off Ver
    Excel 2010
    Posts
    12

    Help with proper syntax for an IF(AND formula construct

    Working on a spreadsheet for my CSE class, theres one cell that I just can't get to work.

    Cell C21 is either W(For water park) or Z(for Zoo)
    Cell C23 is either H(Hot summer) or C(Cool Summer)

    Cell C4 is $500 for daily operating cost of Water park.
    Cell C7 is $3000 for daily operating cost of Zoo.

    Cell B17 is "150" for days each park is open during the year.

    If the chosen park to build is a waterpark, and it is hot, operating costs increase by 5%.
    If the chosen park is Zoo, and it is hot, operating costs reduce by 3%.

    The zoo however, has a 365 day annual cost because the animals still need fed, the water park only has the 150 days.

    This is the formula I came up with, and I can't get it to work for the life of me, Its frustrated me beyond belief

    =IF(AND(C21="W",C23="C"),C4*B17,C4*B17*1.05)IF(AND(C21="Z",C23="C"),C7*365,(C7*B17*0.97)+C7*(365-B17))


    Any help would be so very appreciated, thanks for looking
    Attached Files Attached Files
    Last edited by indians207; 09-14-2013 at 08:37 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Help with a IF(AND( Formula

    Hi Indians and welcome to the forum,

    In your CSE class did they show you the "Evaluate" dialog? On the Formula tab click on the Evaluate Icon. Then step by step you can go through your formula to see what it is doing.

    I hope teaching you how to debug these formulas will be better than giving you an answer....

    Look at http://www.excel-user.com/2010/10/ev...xcel-2010.html for an explanation.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    09-14-2013
    Location
    ohio
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Help with a IF(AND( Formula

    Quote Originally Posted by MarvinP View Post
    Hi Indians and welcome to the forum,

    In your CSE class did they show you the "Evaluate" dialog? On the Formula tab click on the Evaluate Icon. Then step by step you can go through your formula to see what it is doing.

    I hope teaching you how to debug these formulas will be better than giving you an answer....

    Look at http://www.excel-user.com/2010/10/ev...xcel-2010.html for an explanation.
    If you don't mind me asking, is my formula pretty messed up or do I have the general idea down?

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Help with a IF(AND( Formula

    Have you stepped through the EVALUATE dialog and look at each step, to see if it is doing what you are wanting?

    You really need to calculate it by hand and then see if each step in the evaluate does what you intended. I always find a missing parenthesis or comma somewhere that then makes sense later.

    You really need to debug the formula yourself to learn how to do it. I'd hate to have you get a good grade in this class without learning how to debug formulas.

  5. #5
    Registered User
    Join Date
    09-14-2013
    Location
    ohio
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Help with a IF(AND( Formula

    Quote Originally Posted by MarvinP View Post
    Have you stepped through the EVALUATE dialog and look at each step, to see if it is doing what you are wanting?

    You really need to calculate it by hand and then see if each step in the evaluate does what you intended. I always find a missing parenthesis or comma somewhere that then makes sense later.

    You really need to debug the formula yourself to learn how to do it. I'd hate to have you get a good grade in this class without learning how to debug formulas.
    I'm confused about what it evaluates, it says the underlined portion but I can't get it to change to look at different parts of the formula.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Help with a IF(AND( Formula

    the structure of the if formula is wrong
    =IF(AND(C21="W",C23="C"),C4*B17,C4*B17*1.05)IF(AND(C21="Z",C23="C"),C7*365,(C7*B17*0.97)+C7*(365-B17))
    it should be like this
    =IF(AND(C21="W",C23="C"),do something here,IF(AND(C21="Z",C23="C"),do something else here))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Registered User
    Join Date
    09-14-2013
    Location
    ohio
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Help with proper syntax for an IF(AND formula construct

    Thanks everyone, I figured that out and even got a nested formula with 8 IF's to work.
    I have one more question, I have a IRR cell and when I do the IRR function, I'm including 4 cells but I get a NUMBER error.

    The four numbers are
    -20,000,000
    42,188
    -1,327,505
    -1,360,043

    I'm not sure why I'm getting the error, thanks!

  8. #8
    Registered User
    Join Date
    06-07-2017
    Location
    Columbus
    MS-Off Ver
    2017
    Posts
    2

    Re: Help with proper syntax for an IF(AND formula construct

    Can someone please provide me w/the correct formula for Crystal Park?

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Help with proper syntax for an IF(AND formula construct

    erithra68 welcome to the forum

    1. Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    2. What on earth is Crystal Park? Please explain in your new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  10. #10
    Registered User
    Join Date
    06-07-2017
    Location
    Columbus
    MS-Off Ver
    2017
    Posts
    2

    Re: Help with proper syntax for an IF(AND formula construct

    Can you tell me how to start a new thread?

  11. #11
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Help with proper syntax for an IF(AND formula construct

    Click HOME on the side bar menu or, click FORUM on the top menubar.
    Click the sub-rorum: Excel Formulas & Functions
    Click the "POST NEW THREAD" button
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Proper syntax for EV(Expected Value) formula
    By Noobraino in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-20-2012, 09:01 PM
  2. Proper syntax for a time formula
    By nicolelschramartin in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-07-2012, 07:16 PM
  3. Proper syntax to shorten Countif formula
    By small_wonder in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-01-2012, 09:23 AM
  4. [SOLVED] Proper syntax with formula in VBA
    By kcleere in forum Excel General
    Replies: 3
    Last Post: 09-06-2012, 10:44 AM
  5. [SOLVED] Proper SQL Syntax - DAO
    By MSweetG222 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2006, 05:35 PM

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