Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Power excel 2016 with mrexcel Master Pivot Tables, Subtotals, Charts, VLOOKUP, IF, Data Analysis in Excel 2010–2013 (Bill Jelen) (z-lib.org).pdf
Скачиваний:
4
Добавлен:
14.08.2022
Размер:
49.75 Mб
Скачать

118

POWER EXCEL WITH MR EXCEL

 

 

Figure 293 Add a dropdown for months.

The INDIRECT(J10) function tells Excel to go to J10 and the name of a range will be found in that cell. In the figure below, the formula in J12 is getting the intersection of ProdF and Apr, which returns the value of 20.

Figure 294 Intersection of two ranges provides a two-way lookup.

UNDERSTAND IMPLICIT INTERSECTION

Notice that the formulas in the previous two figures were outside of the range B:I. Those formulas would not work in that area due to a feature called “Implicit Intersection”. Here is how it works.

The named range ProdF runs from B7:I7. If you enter a formula anywhere in columns B through I and that formula references ProdF, you will only get the value from that column of ProdF. In the image below, a formula of =ProdF in D10 returns the 13 from cell D7.

PART 2: CALCULATING WITH EXCEL

119

 

 

Figure 295 This formula returns the cell from ProdF that intersects with the formula.

This clearly is not intuitive. In my Power Excel seminars, I occasionally find people who are taking advan- tage of the formula, but few are doing it knowingly. In a similar fashion, a formula of =Apr anywhere in rows 2:8 will return only the April sales from that row.

This feels like the old Natural Language Formulas in Excel 2003, but it is a different feature.

 

FIND THE LONGEST WIN STREAK

 

 

 

 

 

Problem: I have some baseball data with a column showing W or L for wins and losses. I want to calculate

 

the longest winning streak.

 

2

Strategy: Add a helper column to calculate the current winning streak using =IF(C2=”W”,SUM(1,D1),0).

 

Then, look for the MAX of that column.

 

 

Figure 296 The formula in D2 is =IF(C2=”W”,SUM(1,D1),0).

This formula is a classic type of formula that looks at a cell in the current row, makes a decision, and then adds to the value calculated in the previous row. This works great in all cases except in row 2. If you try to calculate =D1+1, you will get an error. Instead, use SUM(D1,1) as the SUM function will ignore the text in D1.

Additional Details: To find the win/loss record, you can use a formula of =COUNTIF(D:D,”W”)&”- ”&COUNTIF(D:D,”L”).

Figure 297 Count the number of W and L values.

120

POWER EXCEL WITH MR EXCEL

 

 

 

ADD B5 ON ALL WORKSHEETS

Problem: I have a workbook with 12 monthly sales reports. Each worksheet has identical rows and col- umns that show sales by week and region. The worksheets are named January, February, …, December.

I want to have a Total worksheet that sums cell E5 on all the other worksheets.

Figure 298 Add cell B5 from each of the monthly worksheets.

Strategy: You will use a 3D reference to spear through all of the worksheets. In the simplest form, a 3D reference lists the first worksheet, a colon, the second worksheet, an exclamation point, and then the cell address. =SUM(January:December!B5).

Figure 299 This formula spears through 12 worksheets.

Gotcha: The formula is not intelligent. It blindly adds up all of the worksheets that are located between January and December inclusive. If you insert a new worksheet in the middle of this workbook to list your lottery numbers, whatever value is in B5 will get added to the formula shown above. If you would for some reason move the November worksheet to the right of the December worksheet, then the November numbers won’t be included in the formula.

Additional Details: The formula above assumes that you do not have spaces in the worksheet name.

If you do have spaces, you will have to add apostrophes around the worksheet names: =SUM(‘January 2014:December 2014!B5).

PART 2: CALCULATING WITH EXCEL

121

 

 

Figure 300 Add apostrophes or you will set up an intersection.

Additional Details: Here is an easier way to enter this formula: 1. Start in cell B5 on the Total sheet. Type =SUM(

2. Click on the January worksheet. The formula starts as =sum(January!

3. Shift-click on the December worksheet. The formula is =sum(‘January:December’! 4. Click on cell B5. The formula is =sum(‘January:December’!B5

5. Press Enter. The formula changes to =SUM(January:December!B5) 2

Thanks to Beth from my seminar at the Louisville Kentucky IMA for the above technique.

The workbook shown below is fairly amazing. In this workbook, there are already four quarterly work- sheets that add up the months from that quarter. You want the Total worksheet to add Q1+Q2+Q3+Q4.

In an amazing twist, you can use a wildcard while typing your 3D reference. The wildcard has to be inside apostrophes, even if your worksheet names do not include spaces. Type =SUM(‘Q*!B5). When you accept the formula, Excel will rewrite the formula as =SUM(‘Q1’!B5,’Q2’!B5,’Q3’!B5,’Q4’!B5).

Figure 301 Use a wildcard in the 3D reference.

Figure 302 Amazingly, Excel rewrites the formula for you.

CONSIDER FORMULA SPEED

Problem: My workbook is calculating really slowly. Are there ways to speed it up?