Spreadsheet Design

Beyond Excel Comments

Beyond Comments in Excel.

I’m not sure how it happen. I’m not sure when it happen. At first I was shocked, then I felt used, now just anger. [;-))))]
Somehow Mike Alexander has hacked into my laptop, and started to steal my blog post ideas. I use ATnotes to jott down any ideas I have for blog posts, here what’s on my desktop at the mo:

Comments in Excel

As you can see top of the list is “x things I hate about Comments in excel”. Well the old piglet has just posted this – nice work. So slightly after, slightly following here’s my list:

  • Can’t change default colour via UI
  • Cant change the default shape via the UI(?)
  • They look rubbish – mac, google anyone
  • Can’t set the start up position – robustly
  • Damage formatting of cells
  • Don’t display correctly with frozen panes etc
  • Can’t get rid of the line (?)
  • The line & arrow are poor quality
  • Are as technically advanced as a stone wheel.
  • Have never been significantly updated
  • Indicator triangles are wrong colour by default (green is a formula error?!)

And I bet there’s more. Unlike Mike though I’m not implementing them for tool tips. I’m interested in error feedback.

Modern programming technologies like .Net, have error providers, these are controls developers can use to track and respond to errors, proactive and reactively. Comments are dumb. They’re just there, and from a user experience P.O.V they don’t offer much. Sure there’re better than nothing, but only just.

Luckily we can work around this. Its really quite easy to put together a formula which can check for errors, then display a message accordingly. It won’t solve all of my issues but it’s another tool in the tool box. Here’s an example from a project I recently worked on. In this case data was entered into a “table” layout, errors where reported at the top of the document. I used a set of functions to the right hand side of the input table to check the important cells in the table.

Comments In Excel 2
Here’s another example but for a more orthodox form. It’s clear to see the benefits over the comments here. If the user enters the right data then no errors message is given, but when it’s wrong, bingo they can get some meaningful feedback, you can also add an additional checks at the end to see if there are any outstanding error on the sheet. As you can imagine you can make this as simple or as complex as your needs require.

Comments In Excel 3

So there you go, if you’re building a worksheet or form thats going to get used a lot, by a lot of different people, then maybe you should take the time to implement custom error messages, and get ride of those rubbish old comments!!!

P.S here’s the last example: MIE Tool Tips Comments Example

Excel Lightbox Viewer

Advances in Excel lightboxes! I’m not sure about you but my spreadsheet is just not complete unless I have some sort of lightbox viewer going on.

Juice have an example here, I have approached it in a slightly different way, and linked to a chart via a picture control, the example work book can be downloaded below.

MIE LightBox

And if you liked Advances in Excel lightboxes stay turned for Advances in Vista like buttons from shapes….what a world we live in.

Here’s the file: M.I.E Light Box

Office 2007 file formates, trouble in the pipeline?

Is anyone else starting to see this happen?

the-2007-issue-begins
I’m finding it more and more common as people update their PC’s and laptops, they get the new edition of Office (2007), and just don’t realise that the file formats have changed and their files can’t be seen by others user. That, and when you do point it out to people, it’s real easy to forget to save files to an older format. Is there a default file type setting in Office 2007?  How are people dealing with this problem? I can only see it getting worst over the next few years, as 2007(+) becomes more widely used.

Update: Here is the link to the file converter pack.

A comparison of worksheet functions

The response to my blog post “Request an Excel blog post” was not stellar! But 2 people did request things. XL Dennis (aka Dennis Wallentin)  asked about Tables in Excel 2007, and Sam had some interest in function performance.
I did a quick video about tables in Excel 2007, which I need to compliment with one about how to use the new referencing system too, but that’s for another day.
Sam was kind enough to send me some work he’s done around function execution speeds. Sam used the MIE calculation tool to help him time these functions – good stuff!
The workbook is here, and the findings might make more sense when you see them in the worksheet ;-)
In Sam’s own words, here’s what he found out:

The — version of sumproduct is faster than the other two
Dsum – Sum is faster than Sumproduct and for Excel 2003 and below should be the most preferred way of summarising data
For 2007 – Sumifs beats everything else hands down
—————————————–
A Match/ Index combo is slightly slower than a Vlookup but more flexible.
But a Single Match column and multiple index columns is much faster than Vlookup. Index is super fast
—————————————–
Dynamic Names(with Index / Counta)  are faster than Table References both of which are faster than full column references
Dynamic Names with UDF is faster than Index/Counta
However  Fixed Range references are faster than Dynamic names of any kind

Here are my thoughts:
Sumproduct and DSum do slightly different things and the fact that DSun is faster kinda makes sense. However it’s easy enough to fall into the trap of relying on SP when other functions are better suited, I hardly every use Dsum, in fact I can’t think of a time I did, so this in a handy reminder!  It also makes me think if there are other instances which I’m missing out on, I bet there are loads!
The Sumif functions seems to trump everything that has come before it (see the vlookup times too) we should try and use these as much as possible.  Sumif’s are arguably easier to write and read the sumproducts too.  If the data fits try and use sumifs in 2007 plus. The performance gains are vast!
Having said that there are some instances when only sumprodct will achieve what you need, and for small data sets or number of functions then the benefits might not be noticeable, but for large data sets and high numbers of function calls it’s worthwhile thinking hard about which function to use.
Indexing/match lookups are about twice as fast as the equivalent vlookups in this example, but be careful because often only one vlookup is needed, and the performance gains might not be as good. I really should test this, but I just want to make the post right now!

References to ranges act as you would expect. Tables in 2007 might be a bit slower than dynamic ranges – not sure there’s that much in it though, but there are significantly different – see t-test on wks. Again I would like to see how these results are effect by relative data set size and number of function calls.

So there you have it a fairly comprehensive look at various “lookup” functions in Excel and Excel 2007. Thanks to Sam for his hard work, putting the tests together and shearing his findings with us, good work Sam!
If you have a topic you’d like to be discussed on this blog, then feel free to leave a comment on the Request post and mail me any supporting data you have.

Download Workbook (.xlsm)

PED (Professional Excel Development) Second Edition!!!!

Back in 2005 Stephen Bullen, Rob Bovey and John Green collaborated on one of the most useful Excel development books ever written. That book, affectionately known as PED (Professional Excel Development) has been a staple for most Excel Devs ever since. As you can see my copy has had a lot of use!

My PED.png

I am happy to say that the second edition is due out later this year, and XL Dennis (aka, Dennis Wallentin) has joined the team to share some of his .NET expertises. I caught up with Dennis to delve into what we can expect from the refresh, his views on Office and .Net and the sate of public telephone boxes in Sweden!

Hi Dennis,

Q: I notice that 2009 marks the 20 year milestone for “XL-Dennis”, for the few readers that might not be familiar with your work and background could you tell us a little bit about what you do?

A: I have a Masters in Business Management & Accounting and I started to use spreadsheet in the mid 80′s. Back then Lotus 1-2-3 was the #1 spreadsheet tool which I used on a daily basis. The concept of XL-Dennis was created in the end of the 80′s and it started out with the Excel 2.1c version. XL-Dennis utilises Excel and other tools to develop professional business solutions. For the last 3-4 years I have been specialising in .NET and VSTO and today most clients’ solutions are based on these two technologies.
20 years with Excel has so far been an exciting journey and I’m looking forward for the coming 20 years.

Q: How did you become involved in the second edition of the PED?

A: When Rob and Stephen outlined the second edition they wanted a new section that covered Excel and .NET. They quickly found out that there are not so many developers in the Excel community that have the knowledge and the practical experience to work with Excel and .NET. So they ended up with a non-English and non-MVP person like me.

Q: I believe this is your first outing as an author, how does it feel to have your name in print and how much work did it all take?

A: That’s correct although I have contributed with some materials in other Excel books. Having your name associated with these guys’  is an absolute honour. To see your name on the coverage (second billing) on a book like PED is very pleasant and satisfying given all the work.
I didn’t count the hours but imagine that you start out with a blank Word document and the final version is 50-60 Word pages per chapter. Although my English has improved the language itself is a barrier that has consumed much time for me.
I take this opportunity to thank Rob for all his support. He has been the team leader for this edition and in my opinion he has done an excellent job. I would also like to thank Gabhan Barry (a Program Manager in the Excel group at Microsoft) who has been the technical reviewer of the .NET chapters.

Q: That’s a significant effort, was it worthwhile, would you do it again?

A: I would say it’s nice when the work is done but during the process you go through all the emotions. At present I would turn down any offers however in the future, and if a new edition of PED is to be produced, then I’ll have probably forgotten all the hard work and say “yes” again.

Q: PED was a critical success, how did you go about writing new material for it. Was this a challenging undertaking and did you feel you had to live up to the high standard it originally set?

A: Initially it was a burden for me but when I realized that I’m the guy with all the .NET knowledge and experience in the team I managed to place myself in a better position. Because I always try to deliver high quality myself the standard of the first edition was not an issue for me. In fact, I got more motivated.

Q: PED’s treatment of Excel was as a powerful development platform. It was aimed at experienced developers, really wanting to push the boundaries of Excel development. Should we anticipate the seconded edition to be pitched at the same audience?

A: Yes, the second edition also targets the professional Excel developer. We continue to support best practice and try to catch up with the latest technologies .NET and VSTO. This is the first Excel book that covers VB.NET and VSTO in detail.

Q: What can we expect to get out of the second edition, what’s new and what’s been updated?

A: Because this is the second edition we feel it is important to be very clear on this aspect so that potential buyers can make a good decision to buy or not.
The second edition includes five new chapters. One chapter covers Ribbon UI in Excel 2007, another new chapter is about creating cross-versions applications and three chapters are about .NET and VSTO. The book has 29 chapters in total so 24 chapters have had minor updates.
If the potential buyer has little interest in .NET and VSTO and already has the first edition of the book then I would recommend to save the money and wait for the next edition.
It is also important to know that to follow the chapters about .NET and VSTO it requires VS 2008 Professional or later. To fully leverage the VSTO chapter it also requires Office 2007. In addition, to put .NET solutions in production it is also recommended using a commercial digital certificate.
With this edition we will launch a site devoted to the book. It will consist of updates, additional materials etc and a forum in which the readers can communicate with us.

Q: The VBA community have been a little reluctant in adopting .NET technologies; do you see this as a problem?

A: As long as the standpoints are based on genuine business terms I cannot see anything wrong with it. For the professional Excel developer the question is not if rather when to adopt .NET. We hope that the second edition will get them started.

Q: VSTA shipped with info path in office 2007 but was not integrated in any other apps. Do you think getting VSTA in Excel would spark some passion for .NET with Office Devs?

A: Looking ahead we know that Microsoft will incorporate a new IDE with Excel. The question is two folded; in which version of Excel will the new IDE be available and which .NET language will be in use. To answer the question I must honestly admit that I have no idea.

Q: What are some of the major benefits to leveraging the .NET Framework over more traditional VBA solutions?

A: Two words: Security and deployment. With .NET we have a new security model and VBA has nothing like it. As for deployment we can now deploy our solutions in several (secured) ways.

Q: Like any new technology .NET has a learning curve. What do you think the average time investment would be for a VBA developer coming to .NET?

A: All I can say is that requires a lot of hard work. As a kick start I would recommend to take a class in general VB.NET programming.

Q: How do you see the future 5 to 10 years shaping up for Office developers? Will VBA still be king, or is a move to .NET just a matter of time?

A: In the foreseeable future we will work with two types of environment: the desktop and the web office. As long as VBA is around it will continue to play a central role for the desktop environment together with .NET while for the web Office environment .NET is the only available alternative.

Q: In the first edition chapter 22 was dedicated to Excel and .NET and its focus was VSTO. Will the update include details on managed Com addins and/or automation?

A: I’m pleased to say that the second edition includes three new chapters devoted to Excel & .NET:
Chapter 24 Excel and VB.NET (77 pp): This is an introduction to the VS IDE, VB.NET and automation of Excel with VB.NET. We have intentionally tried to pitch it at a beginners level.
Chapter 25 Writing Managed COM Add-ins with VB.NET (90 pp): This is the “flagship” for the .NET section in the book and we step through all the steps to create and deploy managed COM add-ins, including a discussion about managed Automation add-ins.
Chapter 26 Developing Excel Solutions with Visual Studio Tools for Office System (58 pp): In this chapter we discuss what VSTO is and when to use VSTO. In our experience this is a must so that the reader can decide if VSTO is something to pick up or not. We also discuss VSTO add-ins and single workbook’s solution together with how to deploy VSTO solutions from a web site.
For the chapter 24 and 25 we have a practical case study: PETRAS Report Tool .NET which interacts with a SQL Server database and with some predefined native Excel templates.

Q: One of the often bemoaned issues with VSTO is that most of the sample code is presented in C#. Happily PED used VB, can we expect this to continue?

A: Yes, PED will still be supporting VB for the foreseeable future. It’s remarkable that Microsoft has such a strong focus on C#, especially if they want professional VBA developers to port themselves to the .NET platform.

Q: Following on from the previous question, what language type do you prefer and why, would you strongly recommend one over the other when targeting Office?

A: In general I would like to avoid discussions about which language to use and so forth.
Today we can meet clients’ requirements for Office solutions with a toolbox that includes a various number of tools, VBA, classic VB, VB.NET and VSTO. In some situations the choice is dictated by the customers or by their desktop environment. In other cases we can select tool(s) to be used on our own.
But if we only discuss the question from a strictly technically perspective then .NET is in favour as it offers a modern IDE.

Q: When can we expect PED to hit the shelves?

A: The book is scheduled to be available in May 2009. (See it at Safari here)

Q: And finally, do you have any plans for a second international VSTO conference in the Phone Box, and will the beer still be free!!!!

A: Actually we will have the release party for the second edition of PED in the Phone Box at XL-Dennis Street. And believe it or not the second VSTO conference will also be held there and at the same time! In addition to the free beer we will also give away unknown bugs in Excel for free too!

Thanks Dennis, I’m sure the second edition will be a success!

For those too impatience or too excited to wait for PED2, why not hop over to Dennis’s blog in the mean time, it’s loaded with Excel and .NET posts covering a multitude to subjects.