How to Calculate Data in Rows and Columns of a Table

  • Ninja Tables row calculation
  • Ninja Tables column calculation
how to use row/column calculation function in Ninja Tables

If there’s one thing we unanimously hate, it’s manual calculation! We simply pull out a calculator to input data (big or small) and get the results. However, a WordPress data table with a large amount of numbers can be a hassle to calculate. With the row/column calculation function of table plugins, the task gets easier.

Row and column calculation to find the total amount of a WordPress numeric data table is one of many cool features of some quality table plugins. We’re sure you can name one or two containing this attribute. But we have chosen to demonstrate with the most user-friendly one, Ninja Tables.

Row/column calculation function in Ninja Tables

No need to cram a WordPress calculator plugin in your already busy dashboard, hoping it can help! Contrarily, turn to Ninja Tables and use its built-in calculation feature. You can have a huge data set of numeric values and unlimited columns/rows. This all-in-one plugin will support you for all.

“Can Ninja Tables show totals?”- as a new user, it can definitely cross your mind. While the answer is yes, you also need to know how. So, we have made a short guide on how to use the Ninja Tables row/column calculation function.

Ninja Tables row calculation

Worry not if you are struggling to count the total data of the rows in your table. We have created a simple data table with four columns only- Number one, Number Two, Number Three, and Results.

row/column calculation function to calculate numeric table data

Now that we have a table, it’s time to calculate the data of rows.

On the Ninja Tables “Table Configuration” panel, click on the pencil icon for the “Results” column. Then open “Transform Value” to add a shortcode to calculate the sum of the 1st three columns.

row/column calculation function for WordPress tables

From the “Enable Excel Formula support for Transform Value”, get the sum formula. The basic single-line shortcode is-

=SUM({{Column 1}}+{{Column 2}}+{{Column 3}})

Inside the curly brackets, enter the “Shortcode Value” for the three columns. For example, put {{row.numberone}} for {{Column 1}}. You can check out the article on Value Transformation.

Afterward, the single-line shortcode is-

=sum( {{row.numberone}} + {{row.numbertwo}} + {{row.numberthree}})

Update and save the code. Open the “Preview” window and notice the “Results” column now shows the sum of each cell of three columns.

WordPress table row/column calculation function

See how easy and swift it was? Using this feature, you can get results of all the big numbers in seconds!

Ninja Tables column calculation

We are done with row data calculation. Now let’s see how to calculate the sum of columns. It could seem a bit trickier than the process we have used for rows. But don’t fret, we have a step-by-step explanation.

To calculate columns, first of all, go to Github link and get the Javascript (JS) code for “Math summation on columns”. Then move to Ninja Tables Custom CSS/JS panel and open “Custom Javascript”.

For the code var myClasses=” “, input the specific column key inside the inverted comma instead of the generic code like column_one. Since we have named the columns Number one, Number Two, Number Three; we will be using those.

row/column calculation function formula

Note: The JS code from the link has to stay exactly the same, except for the column key (name).

If you want to calculate the sum of a single column, you only have to put that column’s name. Here we want the results for all three. So, we put the names with commas between them.

Click the green “Save Custom Javascript” button and open the preview window.

use row/column calculation function to count

A new row appears at the bottom with the total data of each column.

That’s it! It wasn’t troublesome at all, was it?

In case you are skeptical about the results, you can always pull out a calculator to recheck! Though we must warn you it will take a lot of your time to count the sum manually.


Still wondering how to calculate data in rows and columns? Pretty sure we’ve covered how you can get the sum total for table rows and columns in Ninja Tables. Use the process we have illustrated and try it yourself.

Ninja Tables row/column calculation function is easy-to-use for users of all levels. In case you have any confusion, take a look at our detailed documentation. You can be a beginner and still understand the process of calculating the totals of row and column data.

If you face any trouble while calculating WordPress tables, you know where to reach us!

Nusrat Fariha

Hi! I'm a creative content writer at WPManageNinja & Product Marketing Lead at Ninja Tables. I love to work on diverse topics. When I'm not writing, you'll find me going through my favorite books or drawing something!


Leave a Reply