+ Reply to Thread
Results 1 to 4 of 4

Multiple IF statements in a pivot calculated field

  1. #1
    Registered User
    Join Date
    07-06-2020
    Location
    Kansas City
    MS-Off Ver
    2016
    Posts
    2

    Multiple IF statements in a pivot calculated field

    Hello,

    I am trying to use the following IF statement as a calculated field in my pivot table. However, it only recognizes the first IF and rounds to the tenth decimal place as stated first.

    =IF((Conf_pos/Scrn_acn)>=1,ROUND((Conf_pos/Scrn_acn),1),IF((AND(((Conf_pos/Scrn_acn)<1),((Conf_pos/Scrn_acn)>=0.0195))),ROUND((Conf_pos/Scrn_acn),2),ROUND((Conf_pos/Scrn_acn),3)))

    Both "Conf_pos" and "Scrn_acn" are numeric variables in my pivot table.

    Thank you!

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2016 primarily
    Posts
    4,813

    Re: Multiple IF statements in a pivot calculated field

    Calculated fields always sum the fields in the formula before doing anything else, so your formula is actually:


    =IF((SUM(Conf_pos)/SUM(Scrn_acn))>=1,ROUND((SUM(Conf_pos)/SUM(Scrn_acn)),1),IF((AND(((SUM(Conf_pos)/SUM(Scrn_acn))<1),((SUM(Conf_pos)/SUM(Scrn_acn))>=0.0195))),ROUND((SUM(Conf_pos)/SUM(Scrn_acn)),2),ROUND((SUM(Conf_pos)/SUM(Scrn_acn)),3)))

    which I suspect explains what you are seeing?
    Rory
    I drink, and I know things

  3. #3
    Registered User
    Join Date
    07-06-2020
    Location
    Kansas City
    MS-Off Ver
    2016
    Posts
    2

    Re: Multiple IF statements in a pivot calculated field

    Yes, I did know that it sums the fields first, which is what I would like it to do. Why would that prevent the formula from executing correctly?

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2016 primarily
    Posts
    4,813

    Re: Multiple IF statements in a pivot calculated field

    It works for me. Can you post a workbook (see the yellow banner at the top of the page) showing it not working? I assume you haven't applied a specific number format to the field/cells.

+ 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. Creating calculated field and calculated item into a pivot table
    By dvpe in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-12-2019, 12:15 PM
  2. Replies: 1
    Last Post: 06-30-2019, 03:35 PM
  3. Replies: 1
    Last Post: 01-15-2019, 08:54 PM
  4. Replies: 0
    Last Post: 08-15-2016, 02:07 PM
  5. Can't do Calculated Field in a pivot table created from multiple tables?
    By jcurtin in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-26-2014, 09:59 AM
  6. Replies: 0
    Last Post: 06-26-2012, 09:06 PM
  7. Replies: 3
    Last Post: 06-06-2006, 12:10 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