Today, we want to find the most frequent value/number.
Most frequent number
From statistical point of view, we want to find a dominant. This task is quite easy in Excel, however there are some nuances. It’s easy thanks to the MODE function. We can use it to find a single dominant. In this function, we just select the range, and Excel will quickly calculate it for us (Fig. 1)
=MODE(A2:A9)
Fig. 1 MODE function
We have to remember that while using the MODE or MODE.SNGL function, Excel will return only one number. It means that we cannot be sure that only this number is the most frequent one. There is a way out, as we also have the MODE.MULT function (Fig. 2)
=MODE.MULT(A2:A9)
Fig. 2 MODE.MULT function
After using this function, we can see that in our example there are two most frequent numbers: 5 and ‑1. The MODE function showed only the number that appeared at the beginning of the range. When I change the order of the two first numbers in the range, we can see that now the MODE.SNGL function returns ‑1. The MODE.MULT function will still return two number, however in different order (Fig. 3).
Fig. 3 Different order of numbers
When we use the MODE.SNGL function in a range where there isn’t any most frequent numbers and each number occurs only once, the function will return the #N/A error. In our range of Wages, each wage appears only once (Fig. 4)
Today, we are going to learn how to insert scroll bars in Excel and where we can use them.
How to Insert Scroll Bar
In our first example, we have a PMT function. The scroll bars help us change our value for the PMT function more rapidly (Fig. 1)
Fig. 1 PMT function
Let’s insert a scroll bar from the film Excel tips 43, when I was changing the time with a scroll bar. Let’s start with the Developer tab. It’s turned off by default, so we have turn it on. Just right click on the ribbon and choose the Customize the Ribbon option (Fig. 2)
Fig. 2 Customize the Ribbon option
In the window that appeared we have to find the Developer tab, select the proper checkbox and press OK (Fig.3)
Fig. 3 Developer checkbox
Now, we can go to the Insert option and select the Scroll Bars in the Form Controls area. We aren’t interested in ActiveX Controls because they are connected with VBA, and we need something simple. Now, we can draw our scroll bar. When we are holding the Alt key, Excel will fit our scroll bar to cell borders. We don’t always want to do it, but we have such an option. Even after selecting our scroll bar area, when we click the Alt key, Excel will still fit it to cell borders (Fig. 5)
Fig. 5 Cell borders
In our case it isn’t so important. Now, we have our vertical bar (Fig. 6)
Fig. 6 Vertical bar
And horizontal bars (Fig. 7)
Fig. 7 Horizontal bars
Let’s look at properties of the scroll bar. We have to right click to select the scroll bar and right click again to go to the Format Control option (Fig. 8).
Fig. 8 Going to scroll bar properties
In the window that appeared, we have some options, such as Format Control which is now 26, Minimum value which is 0, Maximum value which is 100. We have to remember that scroll bars can have only integer numbers from 0 to 30.000. In our example, I want to work with time and I want the scroll bar to have a 1‑minute precision. It means that I have to set the maximum value to 1440, as this is the number of minutes in one day. The next option, which is Incremental change, is connected to the arrows at the ends of our scroll bars. Then, we have Page change which is connected to clicking on our scroll bar. However, the most important option here is the Cell link bar. We can connect Current value to Cell link. Let’s assume that I want to connect our scroll bar to cell E1. I’m clicking on the cell and pressing OK (Fig. 9)
Fig. 9 Connecting Current value to a cell
Now, the value in cell E1 changed into 26 because that’s the current value in our scroll bar (Fig. 10)
Fig. 10 The same value
When I move the scroll bar, the value in cell E1 is also changing in accordance to the value on the bar. When we click on the arrows on our scroll bar, the time is changing minute by minute downwards or upwards. When we click on the scroll bar, but not on the arrows, we move by 10 minutes upwards or downwards, depending on which part we are clicking. We can move even more rapidly by catching the slider and moving it.
Our value from the scroll bar is an integer. Sometime, though, we need time or percentages. The question is, how can we changed integers into time or percentages? In our example, we have to just divide the value by 1440 and we will get the time in minutes (Fig. 11)
How can we check whether the given time is between the working hours or not?
Is this Time between Working Hours
In our case, work starts at 9:30 AM, and ends at 5:30 PM. Our given time, which is 6:47 isn’t between the working ours. When we change it, we can see that the color changed into red and ‘No’ turned into ‘Yes’, which means that now the time is between the working ours (Fig. 1)
Fig. 1 Our given time is between the working hours
However, when we go to earlier hours we can see that the details changed (Fig. 2)
Fig. 2 Our given time isn’t between the working hours
How can we check our time? The simplest solution is using the MEDIAN function that returns the value in the middle. Since all our times are in one row, we can just select the range (Fig. 3)
=MEDIAN(B2:D2)
Fig. 3 Selecting the whole range
If our data is in separate cells, we can just add those cells one by one (Fig. 4)
=MEDIAN(B2,C2,D2)
Fig. 4 Selecting cells one by one
And just like that we receive the value in the middle. If this value is equal to the given time, it means it’s between the working hours. What’s curious about our median is the fact that it won’t cross our thresholds, i.e. our starting time and finishing time. It means that the smallest value our MEDIAN function can show is the starting hour, and the largest is the finishing hour (Fig. 5)
Fig. 5 The smallest value
Now, we have to check whether our time is between the working hours. We have to compare the function to the given time (Fig. 6)
=MEDIAN(B2,C2,D2)=B2
Fig. 6 Comparing
As we can see, our logical test returned FALSE (Fig. 7)
Fig. 7 FALSE
If the logical test returns TRUE, it means that the given time is between the working ours (Fig. 8)
Fig. 8 TRUE
The answers we have are logical. Let’s make them more human like by adding the IF function to our MEDIAN logical test and some simple text like ‘Yes’ and ‘No’ (Fig. 9)
=IF(MEDIAN(B2,C2,D2)=B2,“Yes”,“No”)
Fig. 9 Adding the IF function
We can see that we can check whether our given time is between the working ours or no (Fig. 10)
Sometimes, we need to make many statistical operations and use many statistical functions in Excel. How can we do it?
Named ranges and statistics
A fast and quick solution is using name ranges. For example, we have the SUM function that sums up all values from January (Fig. 1)
Fig. 1 SUM function
How can we name ranges and use them for our advantage? Let’s start with a simple example of the SUM function. For the SUM function, we have keyboard shortcut which is Alt + =. This way Excel will put the sum for January, which is a range form B2:B6 (Fig. 2)
=SUM(B2:B6)
Fig. 2 Alt + = to put the sum
In the example above we had numbers. However, let’s go to another sheet where we have no numbers. When we want to sum the numbers from the previous sheet, it’s going to be a very tedious job, as we have to move between those two sheets and write proper values. What’s more, the reference we have while using values form another sheet isn’t the easiest to understand. What we can do is naming the ranges. We just have to select a range in a column and write a proper name in the Name Box (Fig. 3).
Fig. 3 Naming the range
Now, when we are using the Alt + = shortcut under our values, Excel will automatically refer to the January range, which is B2:B6 (Fig. 4)
=SUM(January)
Fig. 4 Automatic reference
As we know, Excel remembers names. It means that we can use the name in calculation on a different sheet. When I start writing “ja” in another sheet, Excel will suggest the range name (Fig. 5). I can just accept it and sum the values from January.
Fig. 5 Excel suggested the range name
As we can see, naming ranges makes our work faster. We can also name a bigger group of columns at one time. Just select the group you want. What’s important, when you’re selecting your data, you have to select the top rows, and then the numbers beneath them. Then, go to the Formulas tab, click on the Create from Selection command and select the Top Row checkbox in the window that appeared (Fig. 6)
Fig. 6 Creating names from selection
Now, after we named our ranges, we can see that the February range is named February, the March range is named March and so on. When we move to another sheet, we can use those names (Fig. 7)
Fig. 7 Excel is suggesting the new names
However, we can go one step further using the reference to names. I have January in cell B1. But, when I refer to cell B1, Excel won’t simply convert the text from cell B1 to a range because it just text. It means that our function won’t add anything. First of all, we have to lock the rows (B$1), then add the INDIRECT function to our calculation. Now, the INDIRECT function changes the text into a reference to the proper range (Fig. 8)
=SUM(INDIRECT(B$1))
Fig. 8 INDIRECT function
Now, when I drag the formula to the right, I will have sums from each individual month (Fig. 9)
=SUM(INDIRECT(F$1))
Fig. 9 Sum from individual months
When I copy the formula one cell lower, I’m just changing SUM into AVERAGE (Fig. 11)
=AVERAGE(INDIRECT(B$1))
Fig. 1 SUM into AVERAGE
After I drag it to the right, I have proper results. I do the same with the remaining rows (Fig. 12)
=MIN(INDIRECT(B$1))
Fig. 12 Changing the remaining names
This way, we can quickly add more statistical operations for many months using proper name ranges and the INDIRECT function.
Sometimes, we need to calculate a cubic root, square root or an nth root of a number. How can we do that?
Cubic root, square root and an nth root
First of all, we can use the SQRT function to calculate a square root (Fig. 1)
=SQRT(A3)
Fig. 1 SQRT function
And here we have our results. There is also the POWER function used for calculating the square root with the use of inverse numbers. The number for a square root is 1 divided by 2 (1/2). (Fig. 2)
=POWER(A3,1/2)
Fig. 2 POWER function
As we can see the results are the same. We can even use a simple symbol of raising a number to a power. In the case of a cubic root it will be the number from cell A3 (2), then a caret (Shift + 6). Then, the reverse of a cubic, which is 1/3 written in a parenthesis (Fig. 3)
=A3^(1/3)
Fig. 3 Cubic root
And we have our cubic roots. In the case of the fourth root, we will use the same calculation, which is a caret and, this time, 1/4 (Fig. 4)
=A3^(1/4)
Fig. 4 Fourth root
And we have our fourth root. In the case of the tenth root, I can even write this number as 0.1 (Fig. 5)
=A3^0.1
Fig. 5 Tenth root
And, just like that we have our tenth root (Fig. 6)
Fig. 6 Final results
Depending on the situation, use the calculation you understand the most.