The syntax is: CHOOSE(Index, Value1, Value2, Value3…) The function uses the Index to return a value from the list of one to 254 value arguments. For example, if Index is 2, the second value in the list is returned. We’ll use the CHOOSE() function for each of the day number cells in the first week (A4 to G4). Let’s break it down into the possible desired outcomes: each cell can have one of only three values: blank, if the day is before the 1st; 1, if the day is the 1st, and; the previous day incremented by 1 for any other day, except Sunday.

If you didn’t know, Excel uses integers for dates and 0 is equal to Saturday, January 0, 1900 (yes, Day 0.). To get the next day you add 1, so day 1 is Sunday, January 1, 1900. (Too bad the original programmers didn’t use this day as Day 0 as you will see!) Carrying this methodology forward, July 1, 2016 is really a value of 42,552 which is that many days from day 0. To figure out the day of the week, we use the rarely used function MOD(). This returns the remainder after a number is divided by a divisor.

I’ve input the date for the first of the month in cell D2, so the formula is MOD(D2,7). This divides the value in cell D2 by 7 and returns the remainder which could be 0 through 6. Turns out a remainder value of 0 is Saturday, 1 is Sunday, 2 is Monday and so forth. Using July 1, 2016, MOD(42552,7) = 6 which is Friday. The MOD() function is going to drive the CHOOSE() function’s Index parameter.

All of the day number cells need to use a Custom format so they will just display the day number even though the cell value actually contains a full date value. Just select them, right-click and choose Format Cells…. Select Custom for the Category and enter the letter d in the Type field. Click OK.

Following me so far? Good, let’s get going!

Let’s start with Sunday, cell A4. The full formula is: =CHOOSE(MOD(D2,7)+1,””,D2,””,””,””,””,””). Note I have added a +1 to the MOD() result so now the Index’s range will be 1 to 7, rather than 0 to 6. The Index for the CHOOSE() function cannot be 0 and must be 1 or higher. As such, 1 is now Saturday, 2 is Sunday, 3 is Monday, etc.

Sunday being the first square in the month is sort of an oddball. It can only be blank, if it isn’t the first, or 1 if it is. If Sunday is the first, the Index would be 2. As such, the second value parameter is D2, the first of the month. All other value parameters can be blank (“” –double quotes).

Monday, is a little trickier. The full formula is: =CHOOSE(MOD(D2,7)+1,””,D2+1,D2,””,””,””,””). Let’s walk through each of the CHOOSE() parameters:

- Index: MOD(D2,7)+1. Results in 1 to 7 depending on the value in cell D2 and corresponding to Saturday to Friday
- Value1: “”. If the first is a Saturday (Index = 1), Monday should be blank
- Value2: D2+1. If the first is a Sunday (Index = 2), Monday would be the 2nd of the month
- Value3: D2. If the first is a Monday (Index = 3), set the value to the first of the month
- Value4 through Value7: “”. If the first is a Tuesday through Friday (Index = 4 to 7), Monday should be blank

Here are the formulas for all of the days:

A4 (Sun): =CHOOSE(MOD($D$2,7)+1,””,D2,””,””,””,””,””)

B4 (Mon): =CHOOSE(MOD($D$2,7)+1,””,D2+1,D2,””,””,””,””)

C4 (Tue): =CHOOSE(MOD($D$2,7)+1,””,D2+2,D2+1,D2,””,””,””)

D4 (Wed): =CHOOSE(MOD($D$2,7)+1,””,D2+3,D2+2,D2+1,D2,””,””)

E4 (Thu): =CHOOSE(MOD($D$2,7)+1,””,D2+4,D2+3,D2+2,D2+1,D2,””)

F4 (Fri): =CHOOSE(MOD($D$2,7)+1,””,D2+5,D2+4,D2+3,D2+2,D2+1,D2)

G4 (Sat): =CHOOSE(MOD($D$2,7)+1,D2,D2+6,D2+5,D2+4,D2+3,D2+2,D2+1)

The cells for the second and following weeks are just 1 plus the preceding day number. You might be wondering why I’m using the date values rather than just plain old integers 1 through 31. The reason is I also want to show the filler dates for the following month at the end, if any. Since I’m using the actual date values, once we hit the next month the number automatically restarts at 1. Pretty nifty, eh? If this didn’t matter to you, you could simplify the above first-week formulas with just the numbers 1 through 7 for the Values, as appropriate, in the various formulas.

If you don’t want the next month’s days, you could just wrap the last week formulas in some IF() functions, like =IF(G16=””,””,IF(G16+1>EOMONTH($D$2,0),””,G16+1)). So if the prior cell is blank, display a blank. If it isn’t a blank, see if it’s the past the last day of the month. If so, show a blank, otherwise add one to the prior day value. That said, a less elegant method, but simpler way would be to just delete the formulas for days in the following month.

I hope you enjoyed this little tutorial and will find other uses for the CHOOSE() function. I use it for many things like adding the quarter number (e.g., Q1, Q2, etc.) based on the month. The MOD() function can come in handy in certain unique circumstances where you have many sets of repeating columns or rows.

If you don’t feel like typing, you can download the Excel file here.

]]>

**QUESTION:** *How can we find the average of X months starting with month Y and be able to change those variables without changing the formula?*

Cell K6: =AVERAGE(INDIRECT(“R”&ROW(K6)&”C”&(I6+FirstMonthColLessOne)&”:”&”R”&ROW(K6)&”C”&(I6+FirstMonthColLessOne+J6-1),FALSE))

AVERAGE(range of cells) like AVERAGE(D6:G6). D6:G6 is the reference (e.g., a range of cells). Since we can’t just put D6:G6 in a cell and use that inside AVERAGE(), we have to use the INDIRECT function so Excel can interpret D6:G6 as an address reference and not just text.

The INDIRECT function returns the reference specified by a *text string*. The trick to this exercise was to create a formula that would dynamically create the text string. The formula ended up being:

“R”&ROW(K6)&”C”&(I6+FirstMonthColLessOne)&”:”&”R”&ROW(K6)&”C”&(I6+FirstMonthColLessOne+J6-1)

The parameters for INDIRECT are (ref_text, [a1]). “ref_text” is just the formula above. The second parameter is a logical value that specifies what type of reference is contained in the cell ref_text. If it is TRUE or omitted, ref_text is interpreted as the normal A1-style reference. If FALSE, ref_text is interpreted as an R1C1-style reference, which is what we want so we can use the column number instead of the column letter.

Concatenation is the operation of linking text strings together or simply math with text. Some people use the CONCATENATE function, but that isn’t necessary. Just use the ampersand (&) and “add” text together. It works like a plus sign for text and is more intuitive.

Lets start with things to the left of the colon, “R”&ROW(K6)&”C”&(I6+FirstMonthColLessOne)

** ROW(K6) = 6** and allows us to copy the formula and have the row automatically change

** FirstMonthColLessOne** is a named range for cell K1. A named range was used to make it easier to read the formula. This was purely option. To name a range, simple highlight the cell or range of cell and type the name in the little box in the top-left corner.

The value in I6 is 3 and

The right half of the formula is very similar. The trickiest part is (I6+** FirstMonthColLessOne**+J6-1) which is 3+1+5-1 or 8. The result is R6C8 (i.e., H6).

We add a colon in the middle using &”:”& and end up with R6C4:R6C8 which is the same as D6:H6.

Putting everything together we get:

AVERAGE(INDIRECT(“R6C4:R6C8”),FALSE)) which further evaluates to AVERAGE(R6C4:R6C8,FALSE))

We can now change the starting month and number of months by changing the values in cells I6 and J6.

The INDIRECT function can also be used where you want to use point a VLOOKUP to a range of cells, but that range may change from month to month.

]]>

As you drag holding the Ctrl key, you will see a tiny plus sign (+). The down arrow symbol will indicate where the copy will be inserted.

When you let go of the mouse button, the copy will appear.

]]>Unfortunately, unlike with Word, you can’t just press Ctrl-Z and undo the auto-correction. Fixing this in Excel requires a little more work.

First, click the round Office button in the top-left corner and click the Excel Option button at the bottom of the window that appears.

Select Proofing on the left side and then click the AutoCorrect Options button.

Look at the scrollable window at the bottom. On the left is a list of text that Excel will auto-correct. What it will correct the text to, is shown on the right. To stop Excel from changing (c) to ©, just select the entry with your mouse and click Delete.

Now if you wanted to still be able to get the © symbol, instead of deleting, add a character that would be unlikely to follow the closing parenthesis, say, an exclamation point. Then click the Add button.

Note that this will not replace the existing (c) entry, so you will still need to delete it afterward.

It’s a pretty simple feature and you can add and delete entries at will. You might want to add an auto-correction entry for your name, your company’s name, etc. If you do, my tip here would be to add a special character at the end, so you can better control when the auto-correction takes place, like we did with (c)!.

Hope you can use this helpful tip for an annoying problem.

]]>

Facebook has a similar setting.

HTTPS provides reasonable protection against network sniffing, man-in-the-middle attacks, etc. by creating a secure encrypted connection using the SSL/TLS protocol. It is particularly helpful when using websites over Wi-Fi.

Even if you use this feature, make sure your URL starts with HTTPS: in the address bar, like https://twitter.com. Also, all browsers have a lock icon indicator that tells you when you are connected using SSL. (The location of the lock icon varies depending on the browser and version you are using.)

Note that HTTP isn’t just for Twitter and Facebook. Most sites that require a log in will have an HTTPS page. Sometimes it is automatic, like with banks, but commonly it is not. Often, you just need to add the “S”. Also, realize that it isn’t just for logging in. It secures communication for any information. Just understand that if you are not using HTTPS, the data from your computer all the way to the server hosting the website is open for interception.

Good luck and be safe!

]]>A more simple method is to select the range of cells that will take the data first. Then as you type, Excel will advance the selected cell in the same manner you made your selection.

Below is a simple table that needs some data. Note that the row for the year 2011 highlighted. This was done by dragging the mouse over the cells B5 to D5.

If you start typing data now, after you press the Enter key, the selected cell will now move to the right!

We can take this feature a step further by selecting the entire input range: B5 to D7. Since this is a contiguous range, Excel will default to the down movement, but when you reach the end of a column, it will jump up to the first row of the next column.

If you still wanted to input by row, but wanted to select the entire range, you could select each row while holding down the Ctrl key. The only quirk here is that input will start in the last row you selected and may jump around which may or may not be a problem for you.

As a side note, if you want to change the default action:

- Click the Microsoft Office button (the round icon in the top-left corner of Excel) and open the drop down menu.
- Click on the Excel Options located at the bottom of the menu to bring up the Excel Options dialog box.
- Click on Advanced in the left column.
- Change the Direction where it says “After pressing Enter, move selection”

**TIP:** If you want to reference a cell in a Pivot table, just type the cell reference manually. You can then copy that formula to reference other cells in the Pivot table.

The solution is to copy the Pivot table and then paste the values to a new tab using the Paste Special function (Paste > Paste Values from the Clipboard group on the Home tab). If your Pivot data changes deliberately, you can always re-paste the values.

]]>Right off the bat, you should notice is that rows 11 to 15 are grouped and hidden from view. A closer look should also tell you that rows 3 to 8 are hidden.

Essentially, both features are doing the same thing, but the Group feature gives you an obvious visual cue with the plus (+) sign that something is hidden. The actual Hide feature has no indicator other than the missing row numbers, so it is very easy to miss. The other benefit of using the Group feature is that you can quickly expand or collapse the hidden rows.

To group rows or columns, just select the rows by clicking in the row number or column letter areas. Then click the Group icon on the Outline group on the Data tab.

]]>Then, click on the Format icon and choose Hide & Unhide > Unhide Rows from the Cells group on the Home tab.

If you have hidden several rows, say, 1 through 5, go to cell A1 using the steps above and unhide it. Then, just select the rows surrounding the hidden rows, 1 and 6, on the left side, right-click and choose Unhide.

]]>Using the VLOOKUP function, you can do it very quickly. What you need to do is lookup each account in the new data and see if that account exists in your Balance Sheet. Using the above example, we’ll put formulas next to the new data. Starting in cell D10, the formula to use is

**TIP:** The quick way to add the $ signs is to press the F4 key right after you enter that parameter. (Note that multiple pressing of F4 will cycle you through all the possible $ sign uses, so you can, say, make just the column or just the row absolute.)

You will now see the #N/A error for the GL that does not exist in the Balance Sheet. It’s a pretty simple formula and you can do this analysis in just a few seconds really.

Now, if you want to get elegant, you can use an IF or IFERROR function to return something like “NOT HERE”, but since it’s a throw-away one-time deal, why waste the time.

]]>