Sometimes, we need to insert a population pyramid in Excel or a chart comparing two values.
Population Pyramid Chart
One part of the chart is on the left, while the other is on the right. In order to create something like population pyramid we have to insert a proper chart. I’m using data from Poland as I’m an Excel lover from Poland. We have to have one part of negative values, 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 values where we want to change the sign, then use the Paste Special option (or use the Alt + Ctrl + V shortcut). In the Paste Special window, select the Values radio button and the Multiply radio button in the Operation section. It means that we will be multiplying ‑1 by the selected values (Fig. 1)
Fig. 1 Paste Special window
Now, we have negatives and positives, 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 Clustered Bar option (Fig. 2)
Fig. 2 Clustered Bar option
The chart that appeared isn’t good enough for us. The first modification we want to implement is changing the title. Let’s write ‘Population Pyramid’ (Fig. 3)
Fig. 3 Chart Title change
I also want to modify bars. Let’s click on them, then press Ctrl +1. Format Data Series window will appear where we have to select 100% in the Series Overlap section and set the Gap Width to 10% (Fig. 4)
Fig. 4 Series Overlap and Gap Width options
Now, the bars are larger. The next thing is the Vertical Axis. Click Ctrl + 1 shortcut and go to the Labels tab. Set the Label Position to Low which, in our case, is the left side. In the Specify interval unit let’s leave 1 (Fig. 5)
Fig. 5 Label Position and Specify Interval Unit options
Now, the chart looks much better, but I don’t like the vertical lines here. Let’s click it and press the Delete key (Fig. 6)
Fig. 6 Vertical lines not needed
The next thing we want to change is the horizontal axis where we have person values. It means that we don’t need any negative values. We have to select it, press Ctrl + 1, then in the Format Axis window, we need to go to the Numbers bar. In the Format Code bar, we need to repeat the percent code for the negative values. Let’s add a semicolon, then write 0.00% without any minus sign. Then, we click on the Add button (Fig. 7)
Fig. 7 Format Code bar
Now, we have positive values on the left and on the right side of the chart. What I’m still missing is Data Labels. We have to press the plus sign and select the Data Labels checkbox (Fig. 8)
Fig. 8 Adding Data Labels
We can see that the label font is too big. Let’s make it smaller by selecting the labels and changing the font size on the ribbon (Fig. 9)
Fig. 9 Changing 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 shortcut and go to the Format Data Labels window. We have to open the Number tab and write the percentage once again. We separate the percentages with a semicolon, so that the percentage from the left side corresponds to the left part of the chart, and the right corresponds to the right part. Then, we press Add (Fig. 10)
Fig. 10 Two percentages
In the end, I want to change the position of the legend. Let’s select the legend and press Ctrl + 1. We can see many options concerning the position of the legend (Fig. 11)
Fig. 11 Legend Positions
However, I want to change the position manually. Let’s drag it to the right and change its size. We can also change the size of the bars. There are many more modifications that you can implement. My Population Pyramid is finished and looks as follows (Fig. 12)
Sometimes, we want to add a degree sign to numbers. How can we do it?
Add degree sign (°C) to numbers
Let’s say we want to show temperature in degrees Celsius or Fahrenheit. The first thing we want to do is inserting the correct sign. We can either copy it from the internet or we can choose the Symbol command from the Insert tab (Fig. 1).
Fig. 1 Adding a symbol
In the Symbol window that appears, we’re choosing the Latin‑1 Subset (1), then the Degree Sign, whose name we can see at the bottom of this window. We click the Insert and Close buttons (Fig. 2).
Fig. 2 Symbol window
We can see the Degree Sign in cell D1. After adding C, we have the full symbol. Now, we can copy the symbol in the edit mode, then select all cells with numbers to which we want to add the sign. Then, we press the Ctrl + 1 shortcut. In the Format Cells window we’re choosing the Custom Category, then we’re choosing 0 and we can paste the °C sign. In the Sample bar we can preview 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 double quotes. In this case, it’s a bulletproof solution (Fig. 4).
Fig. 4 Format cells window
And we have our signs correctly inserted (Fig. 5).
How can we create a headline title that is in the Center Across Selection mode?
Merge Cells vs Center across selection
In Excel, we have two solutions. We can select sales and use the Megre&Center command from the Home tab (Fig. 1)
Fig. 1 Megre&Center command
Excel will merge cells into one cell and align it in the center (Fig. 2).
Fig. 2 One, centered cell
This solution, however, has got a small drawback as it created one cell instead of many cells. When we try to select only one column and go a bit too high, we end up in selecting every column (Fig. 3)
Fig. 3 All columns are selected
But, when we go down again, we will select only one column again, so it’s not a big problem. Sometimes, 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 problematic. After selecting the whole range, we want to move it to the right. However, there’s still a problem. If we want to move the range only a bit to the left or right, we cannot do it (Fig. 4).
Fig. 4 Merged cells cannot be moved only a bit
We have to go far enough to the right to make Excel copy the merged cell (Fig. 5).
Fig. 5 Merged cells moved
I want to show you one more solution. Let’s deselect the Megre&Center command. Now that we have our range selected, we can press the Ctrl + 1 shortcut to go to the Format Cells window. In the window, we have to go to the Alignment tab, then select theCenter Across Selection command in the Horizontal area, and press OK (Fig. 6).
Fig. 6 Format Cells window
We can see that our selected cells have merged. But this time, when we try to select one whole column, we can do it (Fig. 7).
Fig. 7 Whole column selected
You have to remember that now the value is located in cell A1. There’s nothing in B1, C1 and D1 cells. The value was just centered across selection. Let’s now change the coloring of the headline title and try to move it a bit to the right (Fig. 8).
Fig. 8 Moving the range
As we can see, it’s possible (Fig. 9).
Fig. 9 The whole range moved a bit
When we have the cell in the Center Across Selection mode, it’s also important that when we want to add some text to one of the cells, the Center Across Selection option will work only on the cells that are not filled (Fig. 10)
Fig. 10 Center Across Selection working only in cells A1, B1 and C1
How to calculate a sum or an average of top 3 maximal values?
Sum of top 3 values
In Legacy Excel, we can use the LARGE function, in which we need to select the range for our calculation. In the k argument let’s write 1 (Fig. 1).
=LARGE($C$2:$C$33,1)
Fig. 1 LARGE function
After entering the function, we have the largest value (Fig. 2).
Fig. 2 The largest value
Now, we can copy the function and add the second and the third largest value (Fig. 3).
This way we have the sum of 3 largest values (Fig. 4).
Fig. 4 The sum of 3 largest values
This solution, however, is the least dynamic of all solutions we have. We can make this formula shorter by hardcoding our values. We have to write 1, 2 and 3 as an array (Fig. 5).
=LARGE($C$2:$C$33,{1;2;3})
Fig. 5 The first, second and third value written as an array
This way Excel will return three largest values. I’m using Dynamic Excel, so the results are spilled (Fig. 6).
Fig. 6 Spilled results
Now, that our values have been hard-coded, we can sum them by using the SUM function. We can also use this function to sum up averages (Fig. 7).
=SUM(LARGE($C$2:$C$33,{1;2;3}))
Fig. 7 Summing up the largest values
Our results (Fig. 8).
Fig. 8 Results
This solution, however, is hard to modify, so we can make it a bit more dynamic. We can use the ROW function and select the first three rows from the sheet. This way our solution is more dynamic (Fig. 9).
=SUM(LARGE,($C$2:$C$33,ROW(A1:A3)))
Fig. 9 A more dynamic solution
Results (Fig. 10).
Fig. 10 Results
But, in Legacy Excel, we should use the SUMPRODUCT function instead of the SUM function or use the Ctrl + Shift + Enter shortcut to put the formula into the cell (Fig. 11).
=SUMPRODUCT(LARGE,($C$2:$C$33,ROW(A1:A3)))
Fig. 11 SUMPRODUCT function
And we have the result. In the second column, in Dynamic Array Excel, we still need the SUM and LARGE functions, then the array which is the range we will look at. Then, we can use the SEQUENCE function to create a sequence of proper numbers, let’s take 3 (Fig. 12).
=SUM(LARGE($C$2:$C$33,SEQUENCE(3)))
Fig. 12 Adding the SEQUENCE function
We have proper results (Fig. 13).
Fig. 13 Results
This solution is much more dynamic. Let’s change the number into 5 (Fig. 14).
=SUM(LARGE($C$2:$C$33,SEQUENCE(5)))
Fig. 14 3 changed into 5
Here is the result (Fig. 15).
Fig. 15 Results
In Legacy Excel, we can also change one number. Let’s change the number of rows in the range from 3 to 5 (Fig. 16).
=SUMPRODUCT(LARGE($C$2:$C$33,ROW(A1:A5)))
Fig. 16 A3 into A5
And we have the same result (Fig. 17).
Fig. 17 Result
We have to remember which version of Excel we have and which solution we can use.
Sometimes, you need to create a running total in pivot tables. How to do it properly?
Running Total in Pivot Table
Let’s start with creating a pivot table. Select one cell from our data and go to the Insert tab and select the Pivot Table command. A Pivot table from table or range window will appear, where we have our range. We need to select the Existing worksheet radio button and write the location, which, in our case, will be cell F1. Let’s click the OK button (Fig. 1).
Fig. 1 Creating a pivot table
And there we have it. In our pivot table we need to drag the Date to the Rows labels.
Fig. 2 Dragging the date
Now, depending on the Excel version, we have an option of Group by dates. I’m going to group our date by months and years (Fig. 3).
Fig. 3 Grouping
We have our table. Now, I want to add Income so let’s press the Income checkbox (Fig. 4).
Fig. 4 Income checkbox
Now, I want to have the income and the running total for the income, so let’s drag the Income two times to the Values area. We can see that we have Sum of Income and Sum of Income 2, where we actually want to have our running total (Fig. 5).
Fig. 5 Income and Income 2
Let’s right click any value from Income 2, then select the Show Values as and then the Running Total In option (Fig. 6).
Fig. 6 Selecting the Running Total option
Now, we have to decide whether we want to base our running total on Date or Years Field. Let’s take Date (Fig. 7).
Fig. 7 Date Field
Now, we can see that in the Income 2 column we have bigger numbers. Let’s format them by pressing any cell in the column and choosing the Number Format option (Fig. 8).
Fig. 8 Number Format option
In the Format Cell window, let’s choose the Currency category, in Decimal places let’s write 0 and press the OK button. Let’s do the same in the Sum of Income column (Fig. 9).
Fig. 9 Format cell window
Now, we can see that we are working with money. In each month we have bigger and bigger numbers which means that we have the running total in this column. We can change the name of Sum of Income 2 into Running Total. Since we are using the Date Field as our reference point, we have the running total in 2020. In 2021 Excel counts from the start, which means that we have the running total only for 2021. The same is with 2022. If we change the Date field into the Years field in the Show Values as (Running Total) window, we will have the same value in the first year and in the Sum of Income column (Fig. 10).
Fig. 10 Years
However, in the next year, we have the the sum from January 2021 and January 2020. In February, we have the sum from February 2021 and 2020. In 2022, we have sums from three Februaries (Fig. 11).
Fig. 11 Sums from three Ferbuaries
Let’s drag Manager into the columns header (Fig. 12).
Fig. 12 Dragging Manager into headers
By doing so, we can show value from the Manager’s perspective, which means a horizontal view.
Fig. 13 Horizontal view
However, this type of data isn’t a proper one to show it this way, so let’s get back by pressing Ctrl + Z two times and see that we can also create a percent running total by going to the % Running Total In option and choose the Date Field (Fig. 14).
Fig. 14 Percentage Running Total
Now, we can see the values as percentage (Fig. 15).