Note: The other languages of the website are Google-translated. Back to English
English English

Sum only cells containing formulas in Excel

Supposing, you have a list of values in Excel, some of them are created by formulas, now, you just want to sum only the cells that contain the formulas as below screenshot shown. How could do this task in Excel?


Sum only cells containing formulas in Excel

In Excel, you can create a simple formula based on the SUMPRODUCT and ISFORMULA functions to sum only the formula cells in a range of cells, the generic syntax is:

=SUMPRODUCT(range*ISFORMULA(range))
  • range: The data range that you want to sum formula cells from.

Please enter or copy the below formula into a blank cell, and then press Enter key to get the calculation, see screenshot:

=SUMPRODUCT(B2:B12*ISFORMULA(B2:B12))


Explanation of the formula:

=SUMPRODUCT(B2:B12*ISFORMULA(B2:B12)):

  • ISFORMULA(B2:B12): This ISFORMULA function is used to test if a cell contains formula. If a cell contains a formula, it will return TRUE, and FALSE if not. So, you will get an array like this: {FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE}.
  • B2:B12*ISFORMULA(B2:B12)= {50;150;35;45;200;80;95;45;50;30;108}*{FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE}: The math operation forces the TRUE and FALSE values to 1s and 0s. So, the multiplication of the two arrays will be like this: {50;150;35;45;200;80;95;45;50;30;108}*{0;1;0;0;1;0;0;1;0;0;1}={0;150;0;0;200;0;0;45;0;0;108}.
  • SUMPRODUCT(B2:B12*ISFORMULA(B2:B12))= SUMPRODUCT({0;150;0;0;200;0;0;45;0;0;108}): At last, the SUMPRODUCT function sums all values in the array to get the result: 503.

Tips: Sum only values skip formulas

If you need to sum values while skipping the formula cells, you can add the NOT function into the above formula like this:

=SUMPRODUCT(B2:B12*NOT(ISFORMULA(B2:B12)))


Relative function used:

  • SUMPRODUCT:
  • The SUMPRODUCT function can be used to multiply two or more columns or arrays together, and then get the sum of products.
  • ISFORMULA:
  • The Excel ISFORMULA function returns TRUE if a cell contains a formula, and FALSE if not.

More articles:

  • Sum If Cells Contain Specific Text In Another Column
  • This tutorial will show you how to sum values if cells contain specific or partial text in another column. Take the below data range as an example, to get the total amounts of the products containing the text “T-Shirt”, both the SUMIF function and SUMPRODUCT function can deal with this task in Excel.
  • Sum Smallest Or Bottom N Values Based On Criteria
  • In previous tutorial, we have discussed how to sum the smallest n values in a data range. In this article, we will perform a further advanced operation – to sum the lowest n values based on one or more criteria in Excel.

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations