You have seen that by selecting multiple cells, some values such as sum, and count and average, depending on the type of cell data, are calculated and displayed in the status bar. As in the following figure:
Now if we want to calculate and display values other than these functions, by right-clicking on the status bar, select the function from the list of several functions that are present in Excel by default, and turn them on. (As in the figure below), but what if we want a function other than these functions? Or even a function we have defined! For this purpose, join us at the end of this post:
To add a custom function other than the above, we perform the following:
First of all, we need to be careful with this, we need coding with VBA. To enter the coding, press Alt + F11 to enter the coding environment. Now if our function is a new function that does not exist in Excel, we must first define the function. To do this, we define the function of the module by adding a module in the module environment. For example, in this section, we have defined a function that in Excel cells write and read the values of hours and minutes, for example, 14:43, so that the calculations can be performed on them. Finally, we can sum up the hours and minutes to get the total time, and again, be displayed in the same format.
Now click on the window of VBAPROJECT on the screen where we want to add a function to it in the status bar and enter the code as shown below:
Now, by selecting the desired cells, the time_sum function for the selected cells is displayed in the status bar:
An example file can be downloaded from the following link: