Forum Discussion

ADumith's avatar
ADumith
Iron Contributor
May 11, 2023
Solved

Catching the #REF bug!

Hello everyone, 

 

I have a cell that shows the value from a pivot table, when I use the controls and change the parameters in the pivot table the value of the cell changes and in some cases the result is #REF!, I wonder if there is a way to capture this error and instead of showing it, it shows a zero (0).

 

 

Thank you in advance, 

  • ADumith 

    May be you can use the IFERROR function in Excel to capture the #REF! error and display a zero instead. Here's an example:

    Let's say the cell with the pivot table value is A1. You can use the following formula to display a zero if the value in A1 results in #REF!:

    =IFERROR(A1,0)

    This formula will return the value in A1, unless it results in the #REF! error, in which case it will return a zero.

    You can also nest the IFERROR function within other formulas if you need to perform additional calculations using the pivot table value. For example, if you need to add 1 to the pivot table value and then display a zero if the result is #REF!, you can use the following formula:

    =IFERROR(A1+1,0)

    This formula will add 1 to the value in A1, unless it results in the #REF! error, in which case it will return a zero.

     

    I hope this helps!

     

4 Replies

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    ADumith 

    May be you can use the IFERROR function in Excel to capture the #REF! error and display a zero instead. Here's an example:

    Let's say the cell with the pivot table value is A1. You can use the following formula to display a zero if the value in A1 results in #REF!:

    =IFERROR(A1,0)

    This formula will return the value in A1, unless it results in the #REF! error, in which case it will return a zero.

    You can also nest the IFERROR function within other formulas if you need to perform additional calculations using the pivot table value. For example, if you need to add 1 to the pivot table value and then display a zero if the result is #REF!, you can use the following formula:

    =IFERROR(A1+1,0)

    This formula will add 1 to the value in A1, unless it results in the #REF! error, in which case it will return a zero.

     

    I hope this helps!

     

    • ADumith's avatar
      ADumith
      Iron Contributor

      Oh! God,

      You are the best....!!!

      Thank you so much.

      • NikolinoDE's avatar
        NikolinoDE
        Gold Contributor
        I am glad that I could help you with your project.
        I wish you continued success with Excel!

Resources