# edit a calculated field from a pivot table

#### alexaronson

##### Active Member
Hello,

I have a pivot table which I have created a calculated field called WMAPE which stands for Weighted Mean Absolute Precent Error. The formula looks like this.

=IF(AND(SUM(Actual)=0,SUM(Forecast)=0),0,IF( SUM(Actual)=0,100,'Abs Error'/Actual))

The first IF is checking to see if a forecast and actual existed, if both values = 0, then WMAPE = 0 since there is no error.

The second if is going to check to make sure if Actual equal 0 than WMAPE is 100 because the user forecasted a value, but nothing shipped.

Else, if neither condition exist, WMAPE is Abs Error / Actual.

It turns out that some of my raw data for Actual contains negative numbers which is causing my WMAPE to return a negative number which is not correct.

I would like to edit the calculated firled to add another IF statement to fix my negative problem. However, I cannot find out how to do that?

Any suggestions?

#### prabby25101981

##### Active Member
What is the value you want to return if Actual is negative? If you want a positive value to be returned, you can use this -

=IF(AND(SUM(Actual)=0,SUM(Forecast)=0),0,IF( SUM(Actual)=0,100,ABS('Abs Error'/Actual)))

Else, can you provide the answer to my first question?

#### alexaronson

##### Active Member
Prabby,

Adding the absolute value to final result would work as well and is probably better than adding another IF statement.

However, I still need to be able to edit the Calculated Field to make the change.

Thanks,

#### alexaronson

##### Active Member
I been struggling with this for about an hour so I decide to post. So I go and post and struggle some more while waiting for help and what you know, I figured it out.

To edit a calcualted field in Office 2007, do the following:
1) Click on the Options tab for the Pivot Table Tools
2) Click on the drop down arrow under Formulas, amd select calculated fields
3) Where it says name, click on the drop down box and select your calcualted field.
4) Edit your formula, and click OK.

1,082,104
Messages
5,363,164
Members
400,720
Latest member
Pettel

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...