+ Reply to Thread
Results 1 to 11 of 11

Can you embed an IF function within an IF fuction?

  1. #1
    Registered User
    Join Date
    10-10-2013
    Location
    California
    MS-Off Ver
    2010
    Posts
    21

    Can you embed an IF function within an IF fuction?

    Hello forum subscribers,

    I have a value in B3, that when multiplied by a fixed rate, I want it to do 1 of 3 things. If less than 25, I want the cell to read 25. If above 485, I want the cell to list 485, and for everything between 25-485, I want it to list the product.

    This is what I have so far:
    Please Login or Register  to view this content.
    Excel errors out, so my question is, can you embed and IF function within an IF function? If so, can someone help pinpoint where my error is?

    P.S. the error prompt highlights the parenthesis of the latter embedded IF function, if that helps with the solution. I also tried surrounding the first [value_if_false] (aka the second/embedded IF function in this case) with "[]" and with "{}", neither of which solved the problem.

    Thank you for your time,

    Sincerely,

    S

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Can you embed an IF function within an IF fuction?

    Yes you can, you could try this one.

    =IF(B3*.0003464<25, 25, IF(B3*.0003464>485, 485, B3*.0003464))
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Can you embed an IF function within an IF fuction?

    Try this.......

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,371

    Re: Can you embed an IF function within an IF fuction?

    Quote Originally Posted by s0o0y View Post
    Hello forum subscribers,

    I have a value in B3, that when multiplied by a fixed rate, I want it to do 1 of 3 things. If less than 25, I want the cell to read 25. If above 485, I want the cell to list 485, and for everything between 25-485, I want it to list the product.

    This is what I have so far:
    Please Login or Register  to view this content.
    Excel errors out, so my question is, can you embed and IF function within an IF function? If so, can someone help pinpoint where my error is?

    P.S. the error prompt highlights the parenthesis of the latter embedded IF function, if that helps with the solution. I also tried surrounding the first [value_if_false] (aka the second/embedded IF function in this case) with "[]" and with "{}", neither of which solved the problem.

    Thank you for your time,

    Sincerely,

    S
    Just remove the second equal sign on your formula...

  5. #5
    Registered User
    Join Date
    10-10-2013
    Location
    California
    MS-Off Ver
    2010
    Posts
    21

    Re: Can you embed an IF function within an IF fuction?

    Thank you, guys. Looks like my error was including the second "=".

    I am new to excel outside of basic use, seems I keep excluding/including just ONE extra character when I try these things on my own, =x. Soon, I will be an intermediate user! Lol...

    Thanks again,

    -S

  6. #6
    Forum Contributor yay_excel's Avatar
    Join Date
    08-12-2011
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    190

    Re: Can you embed an IF function within an IF fuction?

    In Excel formulas, the equals sign can be used two ways:

    If the first character in a cell is the equals sign, it indicates that the cell contains a formula and will attempt to evaluate the rest of the cell contents.
    Any subsequent equals signs are comparison operators, meaning they return either TRUE or FALSE depending on the values surrounding the equals sign in the formula.

    Here is an example of a formula that could use two equals signs:

    =IF(A1=B1,"EQUAL","UNEQUAL")

    This formula tests if A1 is equal to B1 and returns the word EQUAL or UNEQUAL. Usually Excel formulas contain only "=" so unless you intend to do a comparison as illustrated above, you would only use the = at the beginning of the formula.

  7. #7
    Registered User
    Join Date
    10-10-2013
    Location
    California
    MS-Off Ver
    2010
    Posts
    21

    Re: Can you embed an IF function within an IF fuction?

    Thank you, yay_excel.

    I have a strong background in mathematics, and have been known to be called an analytical thinker. So instead of just providing me an answer, the explanation you also provided onto why the second equal sign was causing the said issue means I can now use this knowledge in all future endeavors with excel formulas. This marks my 4th question to the excelforum community, and I appreciate all the help you guys provide, esp. the explanations like this that have helped me solve many additional tasks without needing a consultation!

    Thanks again for being thorough ,

    -S

  8. #8
    Forum Contributor yay_excel's Avatar
    Join Date
    08-12-2011
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    190

    Re: Can you embed an IF function within an IF fuction?

    I understand exactly where you're coming from and greatly appreciated the detailed explanations I received while learning to program (and continue to receive when I'm stumped) so I am happy to spread the knowledge.

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Can you embed an IF function within an IF fuction?

    @s0o0Y

    Please Login or Register  to view this content.
    Please don't forget the girls

    you use the value below in your formula.

    .0003464

    You can put .0003464 in e.g. M2.

    Then you can refer in your formula to cell M2.

    This makes you formula, more dynamic (you only have to change in M2.

    After that the formula would be:

    =IF(B3*M2<25,25,IF(B3*M2>485,485,B3*M2))

  10. #10
    Registered User
    Join Date
    10-10-2013
    Location
    California
    MS-Off Ver
    2010
    Posts
    21

    Re: Can you embed an IF function within an IF fuction?

    Quote Originally Posted by yay_excel View Post
    I understand exactly where you're coming from and greatly appreciated the detailed explanations I received while learning to program (and continue to receive when I'm stumped) so I am happy to spread the knowledge.
    ^ Exactly! Hopefully I can help someone out soon myself, =).

  11. #11
    Registered User
    Join Date
    10-10-2013
    Location
    California
    MS-Off Ver
    2010
    Posts
    21

    Re: Can you embed an IF function within an IF fuction?

    Quote Originally Posted by oeldere View Post
    @s0o0Y

    Please Login or Register  to view this content.
    Please don't forget the girls
    Oh, I mean "guys" in the colloquial sense as a catch all for everyone. Since not everyone who uses this forum is a native English speaker, I will try to use a more neutral word in the future, I mean no offense. .

    That would be a nice method to reduce the clutter in my formula, and provide more utility, but in this example the decimal is a fixed value to determine a (possible) extra fee that will not change.

    With the help you all provided, I was able to complete the ultimate goal of my function, which is actually TWO IF formulas imbedded in another. In case you were curious:

    Please Login or Register  to view this content.
    Yay for being able to reduce a process that checks for 1 factor with two outcomes, and again into 3 more possible outcomes, all into one line/function that runs automatically as I fill in B3 with the value of my product! Yay for formulas, excel, and help from people like you all on this forum!

    Hope you all have a good day/evening,

    -S

+ 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. trying to embed a cell reference in a function
    By Jetus in forum Excel General
    Replies: 3
    Last Post: 02-28-2012, 01:50 PM
  2. [SOLVED] Embed a countif function in subtotal function?
    By Stuck at work in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-13-2006, 11:20 PM
  3. How can I embed a macro into a function in excel?
    By Don in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-27-2005, 10:06 PM
  4. Embed Function
    By Derek in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2005, 09:06 AM
  5. EMBED Function with AutoCAD
    By Derek in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-21-2005, 09:06 AM

Tags for this Thread

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