+ Reply to Thread
Results 1 to 20 of 20

IF Function Does Not Calculate Properly When Adding a 3rd IF formula

  1. #1
    Forum Contributor
    Join Date
    12-16-2014
    Location
    Riverside, IA
    MS-Off Ver
    2010
    Posts
    156

    IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    Hello All,

    The following equation calculates the correct answer, 2264, where D11 = 175 , D10 = 13%:

    =IF('Data Input'!$D$9="Female","",((370+(21.6*'Data Input'!$D$11*1-$D$10))/2.2)*IF('Data Input'!$D$12="10 - 30",1.2))

    but the following modified equation does not calculate the correct answer, 1886 (it calculates 0, an incorrect answer), where D11 still = 175 and D10 still = 13%:

    =IF('Data Input'!$D$9="Female","",((370+(21.6*'Data Input'!$D$11*1-$D$10))/2.2)*IF('Data Input'!$D$12="0",1)*IF('Data Input'!$D$12="10 - 30",1.2))

    Thank you,

    Patrick
    Last edited by EverClever; 07-15-2017 at 10:02 AM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,319

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    Try

    =IF('Data Input'!$D$9="Female","",((370+(21.6*'Data Input'!$D$11*1-$D$11))/2.2)*IF('Data Input'!$D$12="0",1,0)*IF('Data Input'!$D$12="10 - 30",1.2,1))


    No FALSE conditions specified in your original formula: guessing at the above

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    Hi all- @EverClever, you're testing the same cell ($D$12) for two different values. The tests can't BOTH be TRUE, so at least one multiplying clause yields 0. Combine them by nesting one within the other. IF(TRUE,X,else IF(TRUE,Y)) as follows:

    =IF('Data Input'!$D$9="Female","",((370+(21.6*'Data Input'!$D$11*1-$D$10))/2.2)*IF('Data Input'!$D$12="10 - 30",1.2,IF('Data Input'!$D$12="0",1)))

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    BTW, is this correct?:
    =IF('Data Input'!$D$9="Female","",((370+(21.6*'Data Input'!$D$11*1-$D$10))/2.2)*IF...

    Should it be?:
    =IF('Data Input'!$D$9="Female","",((370+(21.6*'Data Input'!$D$11*(1-$D$10)))/2.2)*IF...

    or just:
    =IF('Data Input'!$D$9="Female","",((370+(21.6*'Data Input'!$D$11)-$D$10)/2.2)*IF...

    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Last edited by leelnich; 07-15-2017 at 10:47 AM.

  5. #5
    Forum Contributor
    Join Date
    12-16-2014
    Location
    Riverside, IA
    MS-Off Ver
    2010
    Posts
    156

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    D12 actually has 4 different values because it is a drop down list. So I cut and pasted leelnich's formula below and it only got 1 answer correctly and the other returned 0. John Topley's formula also did not work.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    Will you please attach a sample Excel workbook?

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,319

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    My formula did work: I got a result of 1886
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    12-16-2014
    Location
    Riverside, IA
    MS-Off Ver
    2010
    Posts
    156

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    John Topley,

    Your formula does not work when I insert '10 - 30 into the Data Input worksheet page cell D12, which is the 2nd item on my 4 item drop down list.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    EverClever - please attach YOUR workbook here so that this can be cleared up. It is either user error on your part or something about YOUR file that is messing this up.

  10. #10
    Forum Contributor
    Join Date
    12-16-2014
    Location
    Riverside, IA
    MS-Off Ver
    2010
    Posts
    156

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    AliGW,

    My spreadsheet sample is attached, labeled EverClever-Sample
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,319

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    It doesn't work because I set the FALSE to 0 on the previous D12 test: a little testing would have highlighted the "error".

    =IF('Data Input'!$D$9="Female","",((370+(21.6*'Data Input'!$D$11*1-$D$11))/2.2)*IF('Data Input'!$D$12="0",1,1)*IF('Data Input'!$D$12="10 - 30",1.2,1))

    As previously pointed out if you have multiple choices for D12, then perhaps a "lookup" of some kind is required to determine what we multiply by (rather than multiple IFs).

    As Ali's has requested twice, a workbook is required so we know EXACTLY what is required

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    See post #10, John.

  13. #13
    Forum Contributor
    Join Date
    12-16-2014
    Location
    Riverside, IA
    MS-Off Ver
    2010
    Posts
    156

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    John Topley,

    Thank you for your continued help! I just sent AliGW a sample worksheet. I have never used the LOOKUP Function.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    Not sent to me! Attached above - thanks!

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,319

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    With your sample to have not given the mutiplying "factors" applicable to each age group: so no, you will not get all the answers.

  16. #16
    Forum Contributor
    Join Date
    12-16-2014
    Location
    Riverside, IA
    MS-Off Ver
    2010
    Posts
    156

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    I was just trying to build the formula 1 section at a time to see if it worked before adding on. My original formula did contain 2 of the 4 possibilities, 0 and 10 - 30 but obviously not formatted correctly.

  17. #17
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,319

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    Create a table as below

    0 1
    10 - 30 1.2
    35 - 55 1.35
    60 + 1.5

    I created it F12:G15 of "Data Input!"

    then use ..

    =IF('Data Input'!$D$9="Female","",((370+(21.6*'Data Input'!$D$11*1-$D$11))/2.2)*VLOOKUP('Data Input'!$D$12,'Data Input'!$F$12:$G$15,2,0))
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    12-16-2014
    Location
    Riverside, IA
    MS-Off Ver
    2010
    Posts
    156

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    John Topley,

    That worked! Thank you so much....I would have never figured that out on my own

    Patrick

  19. #19
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,319

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  20. #20
    Forum Contributor
    Join Date
    12-16-2014
    Location
    Riverside, IA
    MS-Off Ver
    2010
    Posts
    156

    Re: IF Function Does Not Calculate Properly When Adding a 3rd IF formula

    Did not see an option on Thread Tools to mark "Solved"?

+ 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. Calling function inside function. (aka nested function)
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2015, 05:58 AM
  2. Replies: 1
    Last Post: 06-10-2015, 12:56 PM
  3. Replies: 13
    Last Post: 04-08-2014, 05:46 AM
  4. index function error using match function to get data from a cell in an array
    By mabildgaard in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-17-2013, 02:21 AM
  5. [SOLVED] IF Function referencing IsNumber, Match, Left function on separate sheets
    By Touch9713 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-12-2013, 10:09 PM
  6. Replies: 1
    Last Post: 03-21-2012, 11:22 AM
  7. Replies: 2
    Last Post: 03-20-2009, 01:29 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