Population Pyramid Chart

Some­times, we need to insert a pop­u­la­tion pyra­mid in Excel or a chart com­par­ing two values. 

Pop­u­la­tion Pyra­mid Chart

One part of the chart is on the left, while the oth­er is on the right. In order to cre­ate some­thing like pop­u­la­tion pyra­mid we have to insert a prop­er chart. I’m using data from Poland as I’m an Excel lover from Poland. We have to have one part of neg­a­tive val­ues, which will go to the left side of the chart. If you want to do it, you have to write ‑1 in one cell, then copy it and select all val­ues where we want to change the sign, then use the Paste Spe­cial option (or use the Alt + Ctrl + V short­cut). In the Paste Spe­cial win­dow, select the Val­ues radio but­ton and the Mul­ti­ply radio but­ton in the Oper­a­tion sec­tion. It means that we will be mul­ti­ply­ing ‑1 by the select­ed val­ues (Fig. 1)

Paste Special window
Fig. 1 Paste Spe­cial window

Now, we have neg­a­tives and pos­i­tives, which is the left and the right side of our chart. We can insert the chart. Let’s select one cell and go to the Insert tab and find the Clus­tered Bar option (Fig. 2)

Clustered Bar option
Fig. 2 Clus­tered Bar option

The chart that appeared isn’t good enough for us. The first mod­i­fi­ca­tion we want to imple­ment is chang­ing the title. Let’s write ‘Pop­u­la­tion Pyra­mid’ (Fig. 3)

Chart Title change
Fig. 3 Chart Title change

I also want to mod­i­fy bars. Let’s click on them, then press Ctrl +1. For­mat Data Series win­dow will appear where we have to select 100% in the Series Over­lap sec­tion and set the Gap Width to 10% (Fig. 4)

Series Overlap and Gap Width options
Fig. 4 Series Over­lap and Gap Width options

Now, the bars are larg­er. The next thing is the Ver­ti­cal Axis. Click Ctrl + 1 short­cut and go to the Labels tab. Set the Label Posi­tion to Low which, in our case, is the left side. In the Spec­i­fy inter­val unit let’s leave 1 (Fig. 5) 

Label Position and Specify Interval Unit options
Fig. 5 Label Posi­tion and Spec­i­fy Inter­val Unit options

Now, the chart looks much bet­ter, but I don’t like the ver­ti­cal lines here. Let’s click it and press the Delete key (Fig. 6)

Vertical lines not needed
Fig. 6 Ver­ti­cal lines not needed

The next thing we want to change is the hor­i­zon­tal axis where we have per­son val­ues. It means that we don’t need any neg­a­tive val­ues. We have to select it, press Ctrl + 1, then in the For­mat Axis win­dow, we need to go to the Num­bers bar. In the For­mat Code bar, we need to repeat the per­cent code for the neg­a­tive val­ues. Let’s add a semi­colon, then write 0.00% with­out any minus sign. Then, we click on the Add but­ton (Fig. 7)

Format Code bar
Fig. 7 For­mat Code bar

Now, we have pos­i­tive val­ues on the left and on the right side of the chart. What I’m still miss­ing is Data Labels. We have to press the plus sign and select the Data Labels check­box (Fig. 8)

Adding Data Labels
Fig. 8 Adding Data Labels

We can see that the label font is too big. Let’s make it small­er by select­ing the labels and chang­ing the font size on the rib­bon (Fig. 9)

Changing the font size
Fig. 9 Chang­ing the font size

There is still one more thing we need to change. There are minus signs on the left side of the chart. So, let’s press the Ctrl + 1 short­cut and go to the For­mat Data Labels win­dow. We have to open the Num­ber tab and write the per­cent­age once again. We sep­a­rate the per­cent­ages with a semi­colon, so that the per­cent­age from the left side cor­re­sponds to the left part of the chart, and the right cor­re­sponds to the right part. Then, we press Add (Fig. 10)

Two percentages
Fig. 10 Two percentages

In the end, I want to change the posi­tion of the leg­end. Let’s select the leg­end and press Ctrl + 1. We can see many options con­cern­ing the posi­tion of the leg­end (Fig. 11)

Legend Positions
Fig. 11 Leg­end Positions

How­ev­er, I want to change the posi­tion man­u­al­ly. Let’s drag it to the right and change its size. We can also change the size of the bars. There are many more mod­i­fi­ca­tions that you can imple­ment. My Pop­u­la­tion Pyra­mid is fin­ished and looks as fol­lows (Fig. 12)

 Finished Population Pyramid
Fig. 12 Fin­ished Pop­u­la­tion Pyramid

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

Add degree sign (°C) to numbers

Some­times, we want to add a degree sign to num­bers. How can we do it? 

Add degree sign (°C) to numbers

Let’s say we want to show tem­per­a­ture in degrees Cel­sius or Fahren­heit. The first thing we want to do is insert­ing the cor­rect sign. We can either copy it from the inter­net or we can choose the Sym­bol com­mand from the Insert tab (Fig. 1). 

Adding a symbol
Fig. 1 Adding a symbol

In the Sym­bol win­dow that appears, we’re choos­ing the Latin‑1 Sub­set (1), then the Degree Sign, whose name we can see at the bot­tom of this win­dow. We click the Insert and Close but­tons (Fig. 2). 

Symbol window
Fig. 2 Sym­bol window

We can see the Degree Sign in cell D1. After adding C, we have the full sym­bol. Now, we can copy the sym­bol in the edit mode, then select all cells with num­bers to which we want to add the sign. Then, we press the Ctrl + 1 short­cut. In the For­mat Cells win­dow we’re choos­ing the Cus­tom Cat­e­go­ry, then we’re choos­ing 0 and we can paste the °C sign. In the Sam­ple bar we can pre­view what our final text will look like in the end. If we want to make sure that our text will be show as a text in the end, we can write it in dou­ble quotes. In this case, it’s a bul­let­proof solu­tion (Fig. 4). 

Format cells window
Fig. 4 For­mat cells window

And we have our signs cor­rect­ly insert­ed (Fig. 5). 

Final results
Fig. 5 Final results

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

Merge Cells vs Center across selection

How can we cre­ate a head­line title that is in the Cen­ter Across Selec­tion mode?

Merge Cells vs Cen­ter across selection

In Excel, we have two solu­tions. We can select sales and use the Megre&Center com­mand from the Home tab (Fig. 1) 

Megre&Cente command
Fig. 1 Megre&Center command

Excel will merge cells into one cell and align it in the cen­ter (Fig. 2).

One, centered cell
Fig. 2 One, cen­tered cell

This solu­tion, how­ev­er, has got a small draw­back as it cre­at­ed one cell instead of many cells. When we try to select only one col­umn and go a bit too high, we end up in select­ing every col­umn (Fig. 3)

All columns are selected
Fig. 3 All columns are selected

But, when we go down again, we will select only one col­umn again, so it’s not a big prob­lem. Some­times, we want to move our data a bit to the right or left. When we try to copy our range, we can’t select only cell B1, which is a bit prob­lem­at­ic. After select­ing the whole range, we want to move it to the right. How­ev­er, there’s still a prob­lem. If we want to move the range only a bit to the left or right, we can­not do it (Fig. 4).

Merged cells cannot be moved only a bit
Fig. 4 Merged cells can­not be moved only a bit

We have to go far enough to the right to make Excel copy the merged cell (Fig. 5).

 Merged cells moved
Fig. 5 Merged cells moved

I want to show you one more solu­tion. Let’s des­e­lect the Megre&Center com­mand. Now that we have our range select­ed, we can press the Ctrl + 1 short­cut to go to the For­mat Cells win­dow. In the win­dow, we have to go to the Align­ment tab, then select the Cen­ter Across Selec­tion com­mand in the Hor­i­zon­tal area, and press OK (Fig. 6). 

Format Cells window
Fig. 6 For­mat Cells window

We can see that our select­ed cells have merged. But this time, when we try to select one whole col­umn, we can do it (Fig. 7).

Whole column selected
Fig. 7 Whole col­umn selected

You have to remem­ber that now the val­ue is locat­ed in cell A1. There’s noth­ing in B1, C1 and D1 cells. The val­ue was just cen­tered across selec­tion. Let’s now change the col­or­ing of the head­line title and try to move it a bit to the right (Fig. 8).

Moving the range
Fig. 8 Mov­ing the range

As we can see, it’s pos­si­ble (Fig. 9).

The whole range moved a bit
Fig. 9 The whole range moved a bit

When we have the cell in the Cen­ter Across Selec­tion mode, it’s also impor­tant that when we want to add some text to one of the cells, the Cen­ter Across Selec­tion option will work only on the cells that are not filled (Fig. 10)

Center Across Selection working only in cells A1, B1 and C1
Fig. 10 Cen­ter Across Selec­tion work­ing only in cells A1, B1 and C1

https://www.youtube.com/watch?v=9P4HxHSbpbA

Sum of top 3 values

How to cal­cu­late a sum or an aver­age of top 3 max­i­mal values?

Sum of top 3 values

In Lega­cy Excel, we can use the LARGE func­tion, in which we need to select the range for our cal­cu­la­tion. In the k argu­ment let’s write 1 (Fig. 1).

=LARGE($C$2:$C$33,1)

 LARGE function
Fig. 1 LARGE function

After enter­ing the func­tion, we have the largest val­ue (Fig. 2). 

The largest value
Fig. 2 The largest value

Now, we can copy the func­tion and add the sec­ond and the third largest val­ue (Fig. 3).

=LARGE($C$2:$C$33,1)+LARGE($C$2:$C$33,2)+LARGE($C$2:$C$33,3)

Adding more values
Fig. 3 Adding more values

This way we have the sum of 3 largest val­ues (Fig. 4). 

The sum of 3 largest values
Fig. 4 The sum of 3 largest values

This solu­tion, how­ev­er, is the least dynam­ic of all solu­tions we have. We can make this for­mu­la short­er by hard­cod­ing our val­ues. We have to write 1, 2 and 3 as an array (Fig. 5).

=LARGE($C$2:$C$33,{1;2;3})

The first, second and third value written as an array
Fig. 5 The first, sec­ond and third val­ue writ­ten as an array

This way Excel will return three largest val­ues. I’m using Dynam­ic Excel, so the results are spilled (Fig. 6).

Spilled results
Fig. 6 Spilled results

Now, that our val­ues have been hard-cod­ed, we can sum them by using the SUM func­tion. We can also use this func­tion to sum up aver­ages (Fig. 7). 

=SUM(LARGE($C$2:$C$33,{1;2;3}))

Summing up the largest values
Fig. 7 Sum­ming up the largest values

Our results (Fig. 8).

Results
Fig. 8 Results

This solu­tion, how­ev­er, is hard to mod­i­fy, so we can make it a bit more dynam­ic. We can use the ROW func­tion and select the first three rows from the sheet. This way our solu­tion is more dynam­ic (Fig. 9). 

=SUM(LARGE,($C$2:$C$33,ROW(A1:A3)))

A more dynamic solution
Fig. 9 A more dynam­ic solution

Results (Fig. 10). 

Results
Fig. 10 Results

But, in Lega­cy Excel, we should use the SUMPRODUCT func­tion instead of the SUM func­tion or use the Ctrl + Shift + Enter short­cut to put the for­mu­la into the cell (Fig. 11).

=SUMPRODUCT(LARGE,($C$2:$C$33,ROW(A1:A3)))

SUMPRODUCT function
Fig. 11 SUMPRODUCT function

And we have the result. In the sec­ond col­umn, in Dynam­ic Array Excel, we still need the SUM and LARGE func­tions, then the array which is the range we will look at. Then, we can use the SEQUENCE func­tion to cre­ate a sequence of prop­er num­bers, let’s take 3 (Fig. 12).

=SUM(LARGE($C$2:$C$33,SEQUENCE(3)))

Adding the SEQUENCE function
Fig. 12 Adding the SEQUENCE function

We have prop­er results (Fig. 13).

Results
Fig. 13 Results

This solu­tion is much more dynam­ic. Let’s change the num­ber into 5 (Fig. 14).

=SUM(LARGE($C$2:$C$33,SEQUENCE(5)))

3 changed into 5
Fig. 14 3 changed into 5

Here is the result (Fig. 15). 

Results
Fig. 15 Results

In Lega­cy Excel, we can also change one num­ber. Let’s change the num­ber of rows in the range from 3 to 5 (Fig. 16).

=SUMPRODUCT(LARGE($C$2:$C$33,ROW(A1:A5)))

A3 into A5
Fig. 16 A3 into A5

And we have the same result (Fig. 17).

Result
Fig. 17 Result

We have to remem­ber which ver­sion of Excel we have and which solu­tion we can use. 

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

Running Total in Pivot Table

Some­times, you need to cre­ate a run­ning total in piv­ot tables. How to do it properly?

Run­ning Total in Piv­ot Table

Let’s start with cre­at­ing a piv­ot table. Select one cell from our data and go to the Insert tab and select the Piv­ot Table com­mand. A Piv­ot table from table or range win­dow will appear, where we have our range. We need to select the Exist­ing work­sheet radio but­ton and write the loca­tion, which, in our case, will be cell F1. Let’s click the OK but­ton (Fig. 1).

Creating a pivot table
Fig. 1 Cre­at­ing a piv­ot table

And there we have it. In our piv­ot table we need to drag the Date to the Rows labels. 

Dragging the date
Fig. 2 Drag­ging the date

Now, depend­ing on the Excel ver­sion, we have an option of Group by dates. I’m going to group our date by months and years (Fig. 3).

Grouping
Fig. 3 Grouping 

We have our table. Now, I want to add Income so let’s press the Income check­box (Fig. 4). 

 Income checkbox
Fig. 4 Income checkbox

Now, I want to have the income and the run­ning total for the income, so let’s drag the Income two times to the Val­ues area. We can see that we have Sum of Income and Sum of Income 2, where we actu­al­ly want to have our run­ning total (Fig. 5). 

Income and Income 2
Fig. 5 Income and Income 2

Let’s right click any val­ue from Income 2, then select the Show Val­ues as and then the Run­ning Total In option (Fig. 6). 

Selecting the Running Total option
Fig. 6 Select­ing the Run­ning Total option

Now, we have to decide whether we want to base our run­ning total on Date or Years Field. Let’s take Date (Fig. 7).

 Date Field
Fig. 7 Date Field

Now, we can see that in the Income 2 col­umn we have big­ger num­bers. Let’s for­mat them by press­ing any cell in the col­umn and choos­ing the Num­ber For­mat option (Fig. 8). 

Number Format option
Fig. 8 Num­ber For­mat option

In the For­mat Cell win­dow, let’s choose the Cur­ren­cy cat­e­go­ry, in Dec­i­mal places let’s write 0 and press the OK but­ton. Let’s do the same in the Sum of Income col­umn (Fig. 9). 

 Format cell window
Fig. 9 For­mat cell window

Now, we can see that we are work­ing with mon­ey. In each month we have big­ger and big­ger num­bers which means that we have the run­ning total in this col­umn. We can change the name of Sum of Income 2 into Run­ning Total. Since we are using the Date Field as our ref­er­ence point, we have the run­ning total in 2020. In 2021 Excel counts from the start, which means that we have the run­ning total only for 2021. The same is with 2022. If we change the Date field into the Years field in the Show Val­ues as (Run­ning Total) win­dow, we will have the same val­ue in the first year and in the Sum of Income col­umn (Fig. 10).

Years
Fig. 10 Years

How­ev­er, in the next year, we have the the sum from Jan­u­ary 2021 and Jan­u­ary 2020. In Feb­ru­ary, we have the sum from Feb­ru­ary 2021 and 2020. In 2022, we have sums from three Feb­ru­ar­ies (Fig. 11).

Sums from three Ferbuaries
Fig. 11 Sums from three Ferbuaries

Let’s drag Man­ag­er into the columns head­er (Fig. 12).

Dragging Manager into headers
Fig. 12 Drag­ging Man­ag­er into headers

By doing so, we can show val­ue from the Man­ager’s per­spec­tive, which means a hor­i­zon­tal view. 

Horizontal view
Fig. 13 Hor­i­zon­tal view

How­ev­er, this type of data isn’t a prop­er one to show it this way, so let’s get back by press­ing Ctrl + Z two times and see that we can also cre­ate a per­cent run­ning total by going to the % Run­ning Total In option and choose the Date Field (Fig. 14). 

Percentage Running Total
Fig. 14 Per­cent­age Run­ning Total

Now, we can see the val­ues as per­cent­age (Fig. 15). 

Results
Fig. 15 Results

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