The most frequent number

Today, we want to find the most fre­quent value/number.

Most fre­quent number

From sta­tis­ti­cal point of view, we want to find a dom­i­nant. This task is quite easy in Excel, how­ev­er there are some nuances. It’s easy thanks to the MODE func­tion. We can use it to find a sin­gle dom­i­nant. In this func­tion, we just select the range, and Excel will quick­ly cal­cu­late it for us (Fig. 1)

=MODE(A2:A9)

MODE function
Fig. 1 MODE function

We have to remem­ber that while using the MODE or MODE.SNGL func­tion, Excel will return only one num­ber. It means that we can­not be sure that only this num­ber is the most fre­quent one. There is a way out, as we also have the MODE.MULT func­tion (Fig. 2)

=MODE.MULT(A2:A9)

 MODE.MULT function
Fig. 2 MODE.MULT function

After using this func­tion, we can see that in our exam­ple there are two most fre­quent num­bers: 5 and ‑1. The MODE func­tion showed only the num­ber that appeared at the begin­ning of the range. When I change the order of the two first num­bers in the range, we can see that now the MODE.SNGL func­tion returns ‑1. The MODE.MULT func­tion will still return two num­ber, how­ev­er in dif­fer­ent order (Fig. 3). 

Different order of numbers
Fig. 3 Dif­fer­ent order of numbers

When we use the MODE.SNGL func­tion in a range where there isn’t any most fre­quent num­bers and each num­ber occurs only once, the func­tion will return the #N/A error. In our range of Wages, each wage appears only once (Fig. 4)

 #N/A error
Fig. 4 #N/A error

https://www.youtube.com/watch?v=XZs8lwM7Oqg

How to Insert a Scroll Bar 

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 exam­ple, we have a PMT func­tion. The scroll bars help us change our val­ue for the PMT func­tion more rapid­ly (Fig. 1)

 PMT function
Fig. 1 PMT function

Let’s insert a scroll bar from the film Excel tips 43, when I was chang­ing the time with a scroll bar. Let’s start with the Devel­op­er tab. It’s turned off by default, so we have turn it on. Just right click on the rib­bon and choose the Cus­tomize the Rib­bon option (Fig. 2)

 Customize the Ribbon option
Fig. 2 Cus­tomize the Rib­bon option

In the win­dow that appeared we have to find the Devel­op­er tab, select the prop­er check­box and press OK (Fig.3)

 Developer checkbox
Fig. 3 Devel­op­er checkbox

Now, we can go to the Insert option and select the Scroll Bars in the Form Con­trols area. We aren’t inter­est­ed in ActiveX Con­trols because they are con­nect­ed with VBA, and we need some­thing sim­ple. Now, we can draw our scroll bar. When we are hold­ing the Alt key, Excel will fit our scroll bar to cell bor­ders. We don’t always want to do it, but we have such an option. Even after select­ing our scroll bar area, when we click the Alt key, Excel will still fit it to cell bor­ders (Fig. 5)

Cell borders
Fig. 5 Cell borders

In our case it isn’t so impor­tant. Now, we have our ver­ti­cal bar (Fig. 6)

Vertical bar
Fig. 6 Ver­ti­cal bar

And hor­i­zon­tal bars (Fig. 7)

Horizontal bars
Fig. 7 Hor­i­zon­tal bars

Let’s look at prop­er­ties of the scroll bar. We have to right click to select the scroll bar and right click again to go to the For­mat Con­trol option (Fig. 8).

Going to scroll bar properties
Fig. 8 Going to scroll bar properties

In the win­dow that appeared, we have some options, such as For­mat Con­trol which is now 26, Min­i­mum val­ue which is 0, Max­i­mum val­ue which is 100. We have to remem­ber that scroll bars can have only inte­ger num­bers from 0 to 30.000. In our exam­ple, I want to work with time and I want the scroll bar to have a 1‑minute pre­ci­sion. It means that I have to set the max­i­mum val­ue to 1440, as this is the num­ber of min­utes in one day. The next option, which is Incre­men­tal change, is con­nect­ed to the arrows at the ends of our scroll bars. Then, we have Page change which is con­nect­ed to click­ing on our scroll bar. How­ev­er, the most impor­tant option here is the Cell link bar. We can con­nect Cur­rent val­ue to Cell link. Let’s assume that I want to con­nect our scroll bar to cell E1. I’m click­ing on the cell and press­ing OK (Fig. 9)

Connecting Current value to a cell
Fig. 9 Con­nect­ing Cur­rent val­ue to a cell

Now, the val­ue in cell E1 changed into 26 because that’s the cur­rent val­ue in our scroll bar (Fig. 10)

The same value
Fig. 10 The same value

When I move the scroll bar, the val­ue in cell E1 is also chang­ing in accor­dance to the val­ue on the bar. When we click on the arrows on our scroll bar, the time is chang­ing minute by minute down­wards or upwards. When we click on the scroll bar, but not on the arrows, we move by 10 min­utes upwards or down­wards, depend­ing on which part we are click­ing. We can move even more rapid­ly by catch­ing the slid­er and mov­ing it.

Our val­ue from the scroll bar is an inte­ger. Some­time, though, we need time or per­cent­ages. The ques­tion is, how can we changed inte­gers into time or per­cent­ages? In our exam­ple, we have to just divide the val­ue by 1440 and we will get the time in min­utes (Fig. 11)

=E1/1440

Changing integers into time
Fig. Chang­ing inte­gers into time

https://www.youtube.com/watch?v=_LCqaHTnNHs

Is this Time between Working Hours

How can we check whether the giv­en time is between the work­ing hours or not?

Is this Time between Work­ing Hours 

In our case, work starts at 9:30 AM, and ends at 5:30 PM. Our giv­en time, which is 6:47 isn’t between the work­ing ours. When we change it, we can see that the col­or changed into red and ‘No’ turned into ‘Yes’, which means that now the time is between the work­ing ours (Fig. 1)

Our given time is between the working hours
Fig. 1 Our giv­en time is between the work­ing hours

How­ev­er, when we go to ear­li­er hours we can see that the details changed (Fig. 2)

 Our given time isn't between the working hours
Fig. 2 Our giv­en time isn’t between the work­ing hours

How can we check our time? The sim­plest solu­tion is using the MEDIAN func­tion that returns the val­ue in the mid­dle. Since all our times are in one row, we can just select the range (Fig. 3)

=MEDIAN(B2:D2)

Selecting the whole range
Fig. 3 Select­ing the whole range

If our data is in sep­a­rate cells, we can just add those cells one by one (Fig. 4)

=MEDIAN(B2,C2,D2)

Selecting cells one by one
Fig. 4 Select­ing cells one by one

And just like that we receive the val­ue in the mid­dle. If this val­ue is equal to the giv­en time, it means it’s between the work­ing hours. What’s curi­ous about our medi­an is the fact that it won’t cross our thresh­olds, i.e. our start­ing time and fin­ish­ing time. It means that the small­est val­ue our MEDIAN func­tion can show is the start­ing hour, and the largest is the fin­ish­ing hour (Fig. 5)

The smallest value
Fig. 5 The small­est value

Now, we have to check whether our time is between the work­ing hours. We have to com­pare the func­tion to the giv­en time (Fig. 6)

=MEDIAN(B2,C2,D2)=B2

Comparing
Fig. 6 Comparing 

As we can see, our log­i­cal test returned FALSE (Fig. 7)

FALSE
Fig. 7 FALSE

If the log­i­cal test returns TRUE, it means that the giv­en time is between the work­ing ours (Fig. 8)

TRUE
Fig. 8 TRUE

The answers we have are log­i­cal. Let’s make them more human like by adding the IF func­tion to our MEDIAN log­i­cal test and some sim­ple text like ‘Yes’ and ‘No’ (Fig. 9)

=IF(MEDIAN(B2,C2,D2)=B2,“Yes”,“No”)

Adding the IF function
Fig. 9 Adding the IF function

We can see that we can check whether our giv­en time is between the work­ing ours or no (Fig. 10)

Human answer
Fig. 10 Human answer

https://www.youtube.com/watch?v=IVZIY6-78sc

Named ranges and statistics

Some­times, we need to make many sta­tis­ti­cal oper­a­tions and use many sta­tis­ti­cal func­tions in Excel. How can we do it?

Named ranges and statistics 

A fast and quick solu­tion is using name ranges. For exam­ple, we have the SUM func­tion that sums up all val­ues from Jan­u­ary (Fig. 1)

SUM function
Fig. 1 SUM function

How can we name ranges and use them for our advan­tage? Let’s start with a sim­ple exam­ple of the SUM func­tion. For the SUM func­tion, we have key­board short­cut which is Alt + =. This way Excel will put the sum for Jan­u­ary, which is a range form B2:B6 (Fig. 2)

=SUM(B2:B6)

Alt + = to put the sum
Fig. 2 Alt + = to put the sum

In the exam­ple above we had num­bers. How­ev­er, let’s go to anoth­er sheet where we have no num­bers. When we want to sum the num­bers from the pre­vi­ous sheet, it’s going to be a very tedious job, as we have to move between those two sheets and write prop­er val­ues. What’s more, the ref­er­ence we have while using val­ues form anoth­er sheet isn’t the eas­i­est to under­stand. What we can do is nam­ing the ranges. We just have to select a range in a col­umn and write a prop­er name in the Name Box (Fig. 3).

Naming the range
Fig. 3 Nam­ing the range

Now, when we are using the Alt + = short­cut under our val­ues, Excel will auto­mat­i­cal­ly refer to the Jan­u­ary range, which is B2:B6 (Fig. 4)

=SUM(Jan­u­ary)

Automatic reference
Fig. 4 Auto­mat­ic reference

As we know, Excel remem­bers names. It means that we can use the name in cal­cu­la­tion on a dif­fer­ent sheet. When I start writ­ing “ja” in anoth­er sheet, Excel will sug­gest the range name (Fig. 5). I can just accept it and sum the val­ues from January. 

Excel suggested the range name
Fig. 5 Excel sug­gest­ed the range name

As we can see, nam­ing ranges makes our work faster. We can also name a big­ger group of columns at one time. Just select the group you want. What’s impor­tant, when you’re select­ing your data, you have to select the top rows, and then the num­bers beneath them. Then, go to the For­mu­las tab, click on the Cre­ate from Selec­tion com­mand and select the Top Row check­box in the win­dow that appeared (Fig. 6)

Creating names from selection
Fig. 6 Cre­at­ing names from selection

Now, after we named our ranges, we can see that the Feb­ru­ary range is named Feb­ru­ary, the March range is named March and so on. When we move to anoth­er sheet, we can use those names (Fig. 7)

Excel is suggesting the new names
Fig. 7 Excel is sug­gest­ing the new names

How­ev­er, we can go one step fur­ther using the ref­er­ence to names. I have Jan­u­ary in cell B1. But, when I refer to cell B1, Excel won’t sim­ply con­vert the text from cell B1 to a range because it just text. It means that our func­tion won’t add any­thing. First of all, we have to lock the rows (B$1), then add the INDIRECT func­tion to our cal­cu­la­tion. Now, the INDIRECT func­tion changes the text into a ref­er­ence to the prop­er range (Fig. 8)

=SUM(INDIRECT(B$1))

INDIRECT function
Fig. 8 INDIRECT function

Now, when I drag the for­mu­la to the right, I will have sums from each indi­vid­ual month (Fig. 9)

=SUM(INDIRECT(F$1))

Sum from individual months
Fig. 9 Sum from indi­vid­ual months

When I copy the for­mu­la one cell low­er, I’m just chang­ing SUM into AVERAGE (Fig. 11)

=AVERAGE(INDIRECT(B$1))

SUM into AVERAGE
Fig. 1 SUM into AVERAGE

After I drag it to the right, I have prop­er results. I do the same with the remain­ing rows (Fig. 12)

=MIN(INDIRECT(B$1))

Changing the remaining names
Fig. 12 Chang­ing the remain­ing names

This way, we can quick­ly add more sta­tis­ti­cal oper­a­tions for many months using prop­er name ranges and the INDIRECT function. 

https://www.youtube.com/watch?v=E9APUsy4y‑E

Cubic root, square root and nth root

Some­times, we need to cal­cu­late a cubic root, square root or an nth root of a num­ber. How can we do that?

Cubic root, square root and an nth root

First of all, we can use the SQRT func­tion to cal­cu­late a square root (Fig. 1)

=SQRT(A3)

SQRT function
Fig. 1 SQRT function

And here we have our results. There is also the POWER func­tion used for cal­cu­lat­ing the square root with the use of inverse num­bers. The num­ber for a square root is 1 divid­ed by 2 (1/2). (Fig. 2)

=POWER(A3,1/2)

POWER function
Fig. 2 POWER function

As we can see the results are the same. We can even use a sim­ple sym­bol of rais­ing a num­ber to a pow­er. In the case of a cubic root it will be the num­ber from cell A3 (2), then a caret (Shift + 6). Then, the reverse of a cubic, which is 1/3 writ­ten in a paren­the­sis (Fig. 3)

=A3^(1/3)

Cubic root
Fig. 3 Cubic root

And we have our cubic roots. In the case of the fourth root, we will use the same cal­cu­la­tion, which is a caret and, this time, 1/4 (Fig. 4)

=A3^(1/4)

Fourth root
Fig. 4 Fourth root

And we have our fourth root. In the case of the tenth root, I can even write this num­ber as 0.1 (Fig. 5)

=A3^0.1

Tenth root
Fig. 5 Tenth root

And, just like that we have our tenth root (Fig. 6)

Final results
Fig. 6 Final results

Depend­ing on the sit­u­a­tion, use the cal­cu­la­tion you under­stand the most. 

https://www.youtube.com/watch?v=tdz5fLm98aE