Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Carmen
 
Posts: n/a
Default If statements in Pivot Table Calculated Fields

Hi,

Is it possible to use an "if" statement in a calculated field if that "if"
statement is referring to a result in another field?

Formula= if(field1="happy", 0, if(
field1="sad",1,if(field1="neutral",2,"field1 was not completed")))

Thanks,
Carmen
  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: If statements in Pivot Table Calculated Fields

Hi Carmen,

Yes, it is definitely possible to use an "if" statement in a calculated field in a Pivot Table. In fact, it can be a very powerful way to manipulate and analyze your data.

Based on the formula you provided, it looks like you want to create a calculated field that checks the values in "field1" and returns a specific result based on those values. Here's how you can do it:
  1. First, create a new Pivot Table or open an existing one that contains the "field1" data.
  2. Next, click on any cell within the Pivot Table to activate the "PivotTable Fields" pane.
  3. In the "PivotTable Fields" pane, locate the "Values" section and click on the dropdown arrow next to "Sum of [field1]" (or whatever the name of your field is).
  4. Select "Add Calculated Field" from the dropdown menu.
  5. In the "Insert Calculated Field" dialog box, give your new field a name (e.g. "Field1 Result").
  6. In the "Formula" field, enter the "if" statement you provided in your question:

    Formula:
    =IF(field1="happy",0,IF(field1="sad",1,IF(field1="neutral",2,"field1 was not completed"))) 
  7. Click "OK" to save your new calculated field.
  8. Your new calculated field should now appear in the "Values" section of the "PivotTable Fields" pane. Drag it to the Values area of your Pivot Table to see the results.

That's it! Your Pivot Table should now display the results of your "if" statement based on the values in "field1". If you need to make any changes to the formula, simply repeat steps 2-7 to edit the calculated field.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

A calculated field will evaluate all text as zero, and can't display
text fields as text in the data area. So, all the calculations would
show zero.

Perhaps you could calculate the field in your source table instead, then
add that field to the pivot table. Instead of "field1 was not completed"
as the final argument, you might want to use a number, so it could be
displayed in the data area.

Carmen wrote:
Hi,

Is it possible to use an "if" statement in a calculated field if that "if"
statement is referring to a result in another field?

Formula= if(field1="happy", 0, if(
field1="sad",1,if(field1="neutral",2,"field1 was not completed")))

Thanks,
Carmen



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a Pivot Table Calculated Field to get a Unique Count Mike Struckman Excel Worksheet Functions 1 November 22nd 05 05:32 PM
Sum of Calculated fields in Pivot Table Graham Excel Discussion (Misc queries) 0 July 4th 05 03:47 PM
How to create a calculated field formula based on Pivot Table resu dha17 Excel Discussion (Misc queries) 1 December 15th 04 05:39 AM
pivot table question, sum fields? Todd L. Excel Worksheet Functions 2 November 30th 04 05:07 AM
Is there an autofill for all row fields in a pivot table? Wendy B Excel Worksheet Functions 2 November 10th 04 01:54 PM


All times are GMT +1. The time now is 03:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"