

We will never spam you. We will only send you product updates and tips.
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.
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.
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.
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.
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.
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.
Wrap-up
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!
Related Posts
Comments
-
Thanks! How to get the count of rows and present it on the frontend?
-
Hi! You can do that using the “Advanced Shortcode” feature. Visit- https://wpmanageninja.com/docs/ninja-tables/miscellaneous/advance-shortcode-usage/ for info. And if you need further help, you can always open a support ticket.
Thank you!
-





Leave a Reply
You must be logged in to post a comment.