msgbartop
Just another WordPress site
msgbarbottom

18 Mar 09 Secret of the giant excel array formula

I’ve already mentioned this on Twitter:

# The secret of my giant excel array formula is soon to be revealed. 928 characters, 78 left braces, 76 function in a cell.# My Excel monster-formula makes 240 cells needless. Half as many lines are enough icon smile Secret of the giant excel array formula 9:13 AM Mar 16th from web# What do you think, how can such a big formula be maintained? Tomorrow I’ll give you the answer.10:39 AM Mar 17th from web# Here’s the great day, and the secret of the giant excel array formula.3 minutes ago from web

One of my customers needed an auxiliary line to perform a calculation reoccurring in every line.This broke the unity of the whole system and made it quite hard to use.My formula was much simpler at the beginning, but I improved it so many times that it became gigantic.It is not easy to review a formula of such size, and to maintain it the traditional way is quite impossible.I turned to VBA for a solution. I pieced the formula together in a macro.I created variables for the recurring parts of the formula, which could even follow from each other:

strDate = "R" & intDateRow & "C"strIndex = "IF(RC" & intIndexColumn & "=0, R24C15, RC" & intIndexColumn & ")"strMonthStartDate = "DATE(YEAR(" & strDate & "),MONTH(" & strDate & ")+1,1)"strMonthEndDate = "DATE(YEAR(" & strDate & "),MONTH(" & strDate & ")+1,0)"

Than from these variables I aggregated the whole function.By breaking apart the formula, it remained maintainable, and comprehensible.This was one of the great secrets, I gathered together in 9 years of Excel programming, but there are a lot more.

16 Feb 09 Relative range names in practice

With range names you can do big tricks with excel.I will show you one of these tricks today:When you define a range name, then excel will propose the absolute cell reference as default.But you can use a relative or a mixed reference too.The active cell is the starting point.You have to create your reference like you would write into that cell.My trick is:

  1. Select A2 cell.
  2. Choose Insert –> Name –> Define
  3. Type a name for the range: “Last”
  4. Write in the refers to box “=A1″ without quotes and without dollar signs.
  5. Give a name to this range, for example “last”

This range name will refer to the upper cell to the current position.It can be used like this:

=SUM(B2:Last)

will give you a dynamic range that will grow or shrink when you insert or delete some rows, even if the deleted row is the last row from the range.This is a perfect solution.If you insert multiple rows and don’t fill every cell, the normal reference will not upgrade, the relative name will always work.

02 Feb 09 Illustrated Excel keyboard shortcuts

It can make our work quicker, if we execute most of the tasks from the keyboard, and use the mouse less frequently.If someone is familiar with a few keyboard shortcuts, he/ she will know the name is not given by chance.With one of my colleagues we created a reminder note, which contains the Microsoft Excel hotkeys for the moves. You can print it on a normal sheet, and put it next to your monitor, to be in view, so you can learn it easily.Please click on the link to download it: http://www.access-excel-vba.com/ms_excel_keyboard_shortcuts.pdfThe keystrokes works with OpenOffice Calc too.Other useful resources:http://exceltip.com/news/excel-shortcut-heaven.htmlhttp://tricks-4-fun.blogspot.com/2008/09/best-excel-shortcuts.html