Median vs Average wages

Why do politi­cians lie to us when talk­ing about aver­age wages? Let’s ask Excel.

Medi­an vs Aver­age wages 

Let’s cal­cu­late some aver­age. The AVERAGE func­tion is a sim­ple func­tion that sums up val­ues from all cells in a range and divides it by the num­ber of cells with val­ues (Fig. 1). 

=AVERAGE(D2:D12)

AVERAGE function
Fig. 1 AVERAGE function

In our exam­ple, the aver­age is $2,900. It means that 8 peo­ple earn less, which gives us around 80% of all peo­ple. It’s impor­tant that one per­son at the bot­tom earns much more than the rest and affects our aver­age more than oth­er peo­ple (Fig. 2). 

Average wages
Fig. 2 Aver­age wages

If we want to talk more pre­cise­ly about the dis­tri­b­u­tion of those wages, we can use the MEDIAN func­tion which returns the val­ue in the mid­dle (Fig. 3). 

=MEDIAN (D2:D12)

MEDIAN function
Fig. 3 MEDIAN function

Since our val­ues are sort­ed, we can clear­ly see the mid­dle val­ue, which is $2,000. We can see that 50% of peo­ple earn this val­ue or less and 50% of peo­ple earn this val­ue or more (Fig. 4). 

Median value
Fig. 4 Medi­an value

If we have an even num­ber of val­ues and there are two mid­dle val­ues, the MEDIAN func­tion cal­cu­lates the aver­age of those two val­ues near the mid­dle line (Fig. 5).

=MEDIAN(G2:G11)

MEDIAN function with even number of cells
Fig. 5 MEDIAN func­tion with even num­ber of cells

We can see that it cal­cu­lat­ed the mid­dle val­ue (Fig. 6). 

Median value
Fig. 6 Medi­an value

If we add one zero to cell D12 which belongs only to one per­son, we can see that the aver­age hit $11,900. It means that only one per­son earns more that the aver­age. On the oth­er hand, the medi­an val­ue stayed the same. It’s very impor­tant to know this dif­fer­ence (Fig. 7). 

Higher average
Fig. 7 High­er average

I also want to add one col­umn with the RAND func­tion (Fig. 8).

=RAND()

RAND function
Fig. 8 RAND function

I want to show you that we don’t have to have our data sort­ed to use the MEDIAN func­tion (Fig. 9). 

Random order, median number the same
Fig. 9 Ran­dom order, medi­an num­ber the same

https://www.youtube.com/watch?v=wLV-xl1735s

Count words in a cell 

How can we count the num­ber of words in a cell?

Count words in a cell 

We can count the num­ber of spaces between words. Let’s have a look at our first exam­ple. In cell A2, we have spaces between words and at the end of each line, so the case is sim­ple. We can use the LEN func­tion here that counts the length of text (Fig. 1).

=LEN(A2)

LEN function
Fig. 1 LEN function

Now, that we have the num­ber of signs, we can remove spaces. We can use the SUBSTITUTE func­tion here. This func­tion will change the old text, which in our case is a space into new text. And since we want to remove spaces, our new text will be an emp­ty text string writ­ten in dou­ble quotes (Fig. 2). 

=SUBSTITUTE(A2,” “,“”)

Fig. 2 SUBSTITUTE function

We can see that the func­tion removed all spaces from our text (Fig. 3). 

No spaces
Fig. 3 No spaces

Now, we can count the length of the text with­out spaces using the LEN func­tion (Fig.4).

=LEN(SUBSTITUTE(A2,” “,“”)

Counting the text length
Fig. 4 Count­ing the text length

Now we know the length (Fig. 5).

Text length
Fig. 5 Text length

Since we know how many spaces there are, we can use the for­mu­la to count the words. We just have to sub­tract this for­mu­la from the pre­vi­ous one (Fig. 6). 

=LEN(A2)-LEN(SUBSTITUTE(A2,” “,“”))

 Subtracting formulas
Fig. 6 Sub­tract­ing formulas

And we have the num­ber of spaces (Fig. 7).

Number of spaces
Fig. 7 Num­ber of spaces

We still have to remem­ber that to count the num­ber of words, we have to add 1 because there is only one space between two words (Fig. 8).

=LEN(A2)-LEN(SUBSTITUTE(A2,” “,“”))+1

One space between two words
Fig. 8 One space between two words

Now we know the num­ber of words in each cell. 

Number of words
Fig. 9 Num­ber of words

If we want to count words from all cells, we can use almost the same for­mu­la. The only thing we have to change is the range which now will be from A2 to A4 (Fig. 10). 

=LEN(A2:A4)-LEN(SUBSTITUTE(A2:A4,” “,“”))+1

Adding a new range
Fig. 10 Adding a new range

In Dynam­ic Array Excel, the results will be spilled, how­ev­er we can sum the up (Fig. 11).

Split results
Fig. 11 Split results

In the pre­vi­ous ver­sion of Excel we can use the the SUMPRODUCT func­tion (Fig. 12). 

=SUMPRODUCT(LEN(A2:A4)-LEN(SUBSTITUTE(A2:A4,” “,“”))+1

 SUMPRODUCT function
Fig. 12 SUMPRODUCT function

Final results (Fig. 13).

Final result
Fig. 13 Final result

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

Count cells with text, COUNTIF function and wildcards

What to do if we want to count cells with text?

Count cells with text, COUNTIF func­tion and wildcards 

For me, the sim­plest solu­tion is using the COUNTIF func­tion and wild­cards. We have an aster­isk that rep­re­sents any text string, even an emp­ty one. We also have a ques­tion mark that rep­re­sents just one sin­gle sign (Fig. 1). 

 Wildcards
Fig. 1 Wildcards

Let’s start with count­ing all cells with text. First, we have to select a prop­er range and press the F4 key to lock it. Then, we have to write an aster­isk in dou­ble quotes so that it counts any text string, even an emp­ty one (Fig. 2). 

=COUNTIF($B$2:$B$11,”*”)

Proper range and an asterisk
Fig. 2 Prop­er range and an asterisk

And just like that we have 4 cells with text. In cell B6 I have past­ed an emp­ty text string and even if we see noth­ing, Excel counts it as a cell with an emp­ty text string. But, what can we do if we don’t want to count emp­ty text strings? We can copy our for­mu­la and add a ques­tion mark next to the aster­isk. It does­n’t mat­ter if it’s before or after the sign (Fig. 4).

=COUNTIF($B$2:$B$11,”?*”)

Formula modification
Fig. 4 For­mu­la modification

This way we count­ed all cells that have at least one sign (Fig. 5). 

Results
Fig. 5 Results

If we want to count all not emp­ty cells, we can change our cri­te­ria to the <> signs (Fig. 6). 

=COUNTIF($B$2:$B$11,”<>”)

Adding <> signs
Fig. 6 Adding <> signs

How­ev­er, the sim­plest solu­tion in most cas­es would be using the COUNTA func­tion, where we don’t have to wor­ry about any cri­te­ria (Fig. 7). 

=COUNTA(B2:B11)

COUNTA function
Fig. 7 COUNTA function

https://www.youtube.com/watch?v=8ywd-H7ALc8

Sparklines Chart in cell | Excel Tips 30

If we want to show our data trend, we can use line charts, how­ev­er they are usu­al­ly large. If we want some­thing sim­ple and small, like a chart in a cell, we can use Sparklines.

Sparklines Chart in cell

All we have to do is to select one emp­ty cell, then go to the Insert tab, then go to Sparklines and select the Line Sparkline option. What we will get is a Cre­ate Sparkline win­dow, where we have to select a a prop­er range and check if loca­tion is good.(Fig. 1). 

 Creating a sparkline
Fig. 1 Cre­at­ing a sparkline

After press­ing OK and drag­ging it down, we have trends for oth­er coun­tries (Fig. 2). 

Ready trends
Fig. 2 Ready trends

If we want to add some mark­ers, we have to open the Mark­er Col­or bar and choose prop­er options (Fig. 3). 

Adding markers
Fig. 3 Adding markers

After adding mark­ers, spar­lines look as fol­lows. If we want to make them big­ger, we have two options. We can sim­ply enlarge the cells or we can merge a few cells using the Merge & Cen­ter option from the Insert tab (Fig. 4).

Cell merging
Fig. 4 Cell merging

Let’s insert a col­umn sparkline there (Fig. 5). 

Inserting a column sparkline
Fig. 5 Insert­ing a col­umn sparkline

I per­son­al­ly don’t like it too much (Fig. 6). 

Columns
Fig. 6 Columns

Let’s change it to line chart again (Fig. 7). 

Lines
Fig. 7 Lines

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

Pie Chart and Percentage % Data Labels | Excel Tips 29

If you have a small dataset, a pie chart is one of the best ways to show it. How can we insert a pie chart?

Pie Chart and Per­cent­age % Data Labels | Excel Tips #29

Let’s start with a sin­gle cell, then go to the Insert tab, then 2D Pie com­mand. And there we have it (Fig. 1). 

A new pie chart
Fig. 1 A new pie chart

We have to remem­ber that a pie chart will include the whole text before num­bers, which, in our case are cities and coun­tries. (Fig. 2). 

Whole text before numbers
Fig. 2 Whole text before numbers

We don’t want to see coun­tries because there will be too many names. Let’s delete our chart and select prop­er ranges, i.e. the City and the Num­ber of res­i­dents columns. Then, select the Insert tab, and 2D Pie com­mand (Fig. 3). 

A pie chart based on two columns
Fig. 3 A pie chart based on two columns

The best part of pie charts are Data Labels. I per­son­al­ly like the Data Call­out option best. We have the cat­e­go­ry name and per­cent­age there (Fig. 4).

Data Callout  option
Fig. 4 Data Call­out option

If you have dif­fer­ent kind of data, you can change the con­tent of data labels. We just have to click once on the pie chart and press Ctrl + 1 key­board com­bi­na­tion. We will see a table called For­mat Data Labels on the right, where we can select and des­e­lect what we wan to see in the labels (Fig. 5). 

Format Data Labels
Fig. 5 For­mat Data Labels

Some­times, we have to sort our data from largest to small­est or from small­est to largest (Fig. 6).

Data sorting
Fig. 6 Data sorting

Remem­ber that a pie chart is rec­om­mend­ed when you don’t have much infor­ma­tion to show. An opti­mal num­ber is around five pieces of infor­ma­tion. In case you have more, a pie chart will be less readable. 

https://www.youtube.com/watch?v=DMFad6D-6SE