Welcome to MSDN Blogs Sign in | Join | Help

Microsoft Excel

The team blog for Microsoft Excel and Excel Services.
Formula building improvements Part 4: Defined Names

Defined names are a very useful tool for authoring formulas.  Defined names allow users to name cell ranges, formulas, and values and refer to those names in their formulas.  Used in formulas, defined names make formulas easier to read and more robust.  Additionally, when writing formulas, names are less likely to get mis-typed than cell references, and they are easier to remember than cell references (“Tax_Rate” as opposed to “G36”).  In this article, I would like to discuss some of the work we’ve done to defined names in Excel 12 – specifically, how we have added new management and creation UI, and how we have added comments to names.

The new Manage Names Dialog

Probably the most common piece of feedback we receive about defined names is that the user interface we provide to manage names is inadequate.  When we visit customers on site, we often see workbooks with dozens or hundreds and even thousands of defined names, which makes tasks like deleting multiple names, renaming names, and finding broken ones challenging.  Enter the new Manage Names dialog, which is designed specifically for viewing and managing the defined names in a workbook.

The entry point to the Manage Names dialog is in the centre of the new Formulas tab.  Here is a shot of the Formulas tab in current builds - you can see a big button titled "Name Manager".


(Click to enlarge)

When you click on the Name Manager button, you will see the Manage Names dialog.
 


(Click to enlarge)

Using this dialog, you can:

View existing Defined Names

  • See the name’s reference (“Refers to” control), the name’s scope (“Scope” Column), and the name’s value (“Value” Column – note, this displays error values as well)
  • Confirm whether it is referenced in the grid or not (the “In Use” column)

Create New Names

  • Easily define the scope of a name in the New Name dialog (dialog discussed below)
  • Easily set the name reference

Edit existing names

  • You can now rename a name without having to redefine it from scratch
  • You can quickly modify scope from the Edit Name dialog  (dialog discussed below)

Delete Names quickly

  • Select and delete multiple names at once

Sort the Name list

  • You can sort the name list by clicking on the column headers

Resize the Manage Names dialog

  • Make the refers-to box as wide as you need, so the number of names you can see is limited only by your monitor size

Filter the Name List

  • A powerful filter drop down allows you to filter large name lists based on a number of common criteria including scope, in use, and if the name returns an error
  • You can set multiple filters by simply selecting whatever filters they want … for example, you can filter to see all defined names that are not in use an that return errors with two mouse clicks


(Click to enlarge)

One thing we would be interested in hearing is whether hidden names should be surfaced in this dialog.  The current design allows users to show hidden names using a control on the filter drop-down, but they are not displayed by default.  Our reasoning for this is that customers tell us hidden names cause many problems for users and generate helpdesk issues.  At the same time, some solution providers use them as variables with the knowledge that you can't see them in the UI.  Our current design would allow savvy users to find the hidden names without writing code.  Note, there is a workaround for solution developers, which is to use very hidden names which can be created by using the hidden namespace in XLM (i.e. SET.NAME).

The New Name/Edit Name Dialog

While we were improving name management, we set another goal to simplify the experience of creating a name.  To do this, we created a dialog that surfaces the UI needed to define a new name or edit an existing name (the title of the dialog changes between New Name and Edit Name depending on the context of how it was launched).  Of note is the Scope drop down which allows the user to easily set the scope of their name to a specific sheet or the entire workbook (no more secret knock needed).


For mouse users, we’ve made it easier to get to the new name UI by adding a right-click menu option that will launch the dialog with the selected range in its refers-to box. 


Other entry points exist on the Ribbon and Manage names dialog.


Name Comments

Finally, I’d like to talk about an enhancement to the Defined Name object itself – we have added a name comment property.   The comment property allows the user to document what a name refers to, what it should and should not be used for, etc.  This field can be edited from both the UI (New/edit name dialogs) and the OM and is surfaced as the name’s tooltip in formula auto complete as well as in the Manage Names dialog. 


Some Interesting uses of this field might include

  • Detailed description of a Names purpose
  • Name auditing (track changes, data refresh dates, etc)
  • General notes

Another thing we would be interested in hearing is how would you use the name comment feature.

That wraps up "Formula Editing Improvements Week"; I hope you found this interesting.  Talk to you next week.

Posted: Friday, October 21, 2005 4:38 PM by David Gainer

Comments

Rob van Gelder said:

Name Comments - awesome!

I'd use them to hint at which linked workbooks rely on them.

Could you please describe how the "In Use" works? Will they work with INDIRECT("my_range")?

Rob
# October 21, 2005 9:36 PM

Hazz said:

This sounds great.

How much text can the named range comment accommodate and how much will show up in the tooltip? If there is enough then change tracking sounds like a great idea.

Also is the New/Edit name dialog sizable, so we can see the text of long comments or long formulas?

Will dynamic named ranges (named formulas) support 3D ranges (which probably boils down to will the offset formula support 3D range selection)?

Speaking of which, the ability to used 3D ranges for the sumproduct function would be huge too!

Finally Thanks for the great Blog and info, I'm looking forward to 12. The new UI & Features look great and would sell the product (for me) by themselves, but the increased limits would also sell 12 (for me) by themselves. I agree with http://www.dicks-blog.com/archives/2005/10/13/too-many-cells/ that the only times I hit the current row limits is when using Excel as a temporary information processing tool. The new limits will make Excel a better tool for exactly this kind of work. The new UI features such as the Name manager and resizing the name box will also greatly help in managing large data sets and complex analysis.

Hazz
(Business Analyst)
# October 21, 2005 9:58 PM

Jean Martineau said:

Defined Names improvements, like all your others topics, are going to be very useful for advance and non advance users. You and your team are doing a really good job.

I don't know if it could be possible to have an option so the range of a defined name could be dynamic. This option would be easier than
=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1)
and it should also be available for Insert>Name>Create. For this last case, it should be also an option for the name comments to come directly from the comments of the header cells.

Jean
# October 21, 2005 10:25 PM

Gary said:

i think dymanic ranges would be a good addition, too.
# October 21, 2005 10:49 PM

Bob Whiton said:

Being a solution developer that makes heavy use of hidden Name Ranges, we would prefer to not surface the hidden ones by default. Showing these to the user would allow them to 'experiment' with them which could cause problems on our end.

Nice feature!
# October 21, 2005 11:22 PM

Bob Whiton said:

As a follow-up to my last comment...

We would actually prefer that the user be unable to very hidden names. We haven't had the need to give too much research into very hidden names but as far as I can tell they need to be set/get with the use of a ExecuteExcel4Macro call (kind of a clunky way to use named ranges).

By not allowing the user to view hidden named ranges through the UI, we could continue to simply set their visible property to false and not be too worried with the user seeing them.
# October 21, 2005 11:31 PM

Harlan Grove said:

Looks good.

For those (possibly few) of us who are diehard keyboard users and avoid using mice as much as possible, will it still be possible to create worksheet-scope names by preceding the name with the worksheet name, e.g., entering the name to define as ViewSheet!MyName?

As for hidden names, any chance they could be viewable but not editable? Seeing them may be innocuous. Letting users change either their names, definitions or scope could be a major headache. If the UI can't treat them as read-only, then better not to show them.

And you didn't mention it in your earlier post about the new expanded limits. How long can the definition of a defined name be? Currently they're limited to 255 characters. Will they now have the same limits as cell formulas?
# October 22, 2005 2:57 AM

anon said:


I find it odd that you didn't take the chance to remove that restrictive "no space char allowed here" restriction in names. I mean, those are tags and only technical limitations have made names so cumbersome to use.
# October 22, 2005 9:40 AM

Harlan Grove said:

anon...
|I find it odd that you didn't take the chance
|to remove that restrictive "no space char
|allowed here" restriction in names. I mean,
|those are tags and only technical limitations
|have made names so cumbersome to use.

Unfortunately space characters are either used as intersection operators between range references or as whitespace between other tokens. For example, if you had defined range names (w/o single quotes) 'a', 'a b' and 'b' would =SUM(a b) return the sum of range 'a b' or the intersection of ranges 'a' and 'b'.

While this may have been an unfortunate choice, once done it's done and can't, practically, be undone.
# October 22, 2005 3:23 PM

anon said:


Next Excel version breaks a lot of things, the UI, the look and feel. This is a great opportunity to fix this space char thing. After all, saving as xml fixes the problem with bit-based binary formats.
That they don't do it now is because they don't understand the user entering a name only to be prompted with a message box with some non sense sentence in it. From a user point of view, anything that makes it easier to use is valuable. From a developer perspective, anything that makes the plumbing look consistent and less broken is valuable.

There will be more time in the future for adding shiny color gradients. But since Excel 12 file format is disruptive, why not take the chance and fix it all?

# October 22, 2005 4:33 PM

Jim Rech said:

David-

Some of those defined names and sheet names in the screen shots look _very_ familiar to me. I don't remember sending you guys my "Expat" workbook but sure looks like I did.<g>

Jim
# October 22, 2005 6:27 PM

Jim Rech said:

Hidden Names...

It's not clear to me whether hidden names can be created (and switched to and from visible) via the new UI. To let users see them (and delete them) but not create them is leaving out some pretty important functionality I think.
# October 22, 2005 6:34 PM

Jim Rech said:

Hidden Names II-

I think the new UI should have the ability to deal with hidden names just as if they were visible. And I think that ability should be turned off by default. However, since hidden names are something only developers need to be concerned about for the most part, the "switch" should be in a less prominent place than it is now. Maybe even as a VBE setting.

I think it's somewhat similar the Windows Explorer option to show hidden files. It's there for the more techie user but it's not "in your face".
# October 22, 2005 6:49 PM

headtodie said:

Please do not allow the users to easily view very hidden names. It is important that developers have at least one hidden location to temporarily store things likes keys, user IDs and passwords.
# October 22, 2005 7:18 PM

Harlan Grove said:

For anon,

I agree it would have been good if Microsoft had FIRST fixed outstanding problems THEN added functionality, but that's not to be, it seems.

Increasing the limits is good, but it means severely reduced backward compatibility. Since there's been very little added in Excel since XL8 (97), this upgrade will come as a major jolt. Agreed that this SHOULD have opened the way to wholesale fixes (restrictions on range names, fixing the kludgy external workbook referencing syntax, 3D references that seem to have no representation in the object model, various built-in functions that should work A LOT better than they do), but it seems there's already a feature lock.

But you need to realize that the last several versions have provided very little more than eyewash and closer integration with the rest of Office. We should be thankful this time around Microsoft's actually adding some useful spreadsheet functionality to go with the eyewash.
# October 22, 2005 7:35 PM

Jim Rech said:

I has a misgiving about the New Name dialog, specifically the Scope drop down.

It appears that the Scope drop down has in it, at least, "Workbook" and the name of every worksheet in the active workbook. If that's the case I think it's overkill. I believe the scope choices should be Workbook and Worksheet (or Current Sheet). How likely is it that a user will be on Sheet1 with the intent of creating a name local to Sheet2? Negligible I'd say. And in the off-chance he did want to create a name local to Sheet2 referring to a range on Sheet1 I think he should have to start on Sheet2, in exchange for way simplifying this dialog.

A client recently sent me a workbook of 761 worksheets. Do we really want the names of 761 sheets clogging up this dialog?

David, if I'm missing something please don't spare my feelings.<g>
# October 22, 2005 10:36 PM

Jan Karel Pieterse said:

Jim:

I agree about the scope dropdown, but like to suggest a bit more intelligence:

I would suggest something along the lines of what Charles Williams and my Name Manager does:

1. Current name refers to a single sheet

- just use offer that sheet to localise to

2. Current name refers to multiple sheets

- just show those, so the user can pick which to localise to

3. Current name refers to no sheet

- show all sheets to localise to.

I think you are right in stating that in this last case just showing the active worksheet should do.
# October 23, 2005 5:30 AM

Roger Crawley said:

Would it be possible to enable the name comment to display the "Refers To" property?
Is the user going to be able to customise what can be displayed?

I find it incredibly frustrating when named ranges are used for almost everything. Whilst it may make understanding formulae easier (IF sensible names are used following a consistent convention). However, for auditing formulae I find it more of hindrance because you cannot the identify ranges used.
# October 24, 2005 4:49 AM

Mpemba said:

Excellent.

At last something really useful.

The historical name handling has always been a problem: being able to easily control/set the scope of names is particularly useful.

This looks like real progress.

Did I miss something: is the name drop-down box going to be wider than in the current version (or even better, customisable?)

M
# October 24, 2005 5:51 AM

Helen said:

Hidden names should stay hidden from the users, in my opinion. That's the only place where we (developers) can store data that the user cannot see without VBA - other than xlVeryHidden sheets, but those have a lot more overhead.

Alternatively, how about extending the concept of xlVeryHidden to names? Have "just hidden" names that users can show/hide manually, and very hidden names that can only be shown / hidden with VBA.
# October 24, 2005 6:56 AM

Markus K. said:

Great stuff - can't wait to get my hands on Excel 12. I moved from Lotus 1-2-3 for DOS (!) to Excel 14 years ago and the sum of what you're showing here will be almost as big an improvement.

Could I share one dream? A chart (e.g. bar chart). I right-click one data set. I can choose to change this data series (and none other) to a line. In other words, form of presentation (at least between compatible forms of presentation, e.g. bar/line) is a property of a data series just like colour. What do you think?
# October 24, 2005 2:12 PM

Tianwei said:

Viewable, Hidden and Very Hidden is a good architecture just as Sheets. I vote yes for allowing user show hidden names and have developer level go to VBE to do the Very.

David, would 12 allow user to define a name for column headings instead of ABC...? Allow a toggle option for user to turn on names or true Excel headings (BTW, SAS has the ability when viewing data).

Also, extremely like the idea of Jean Martineau about dynamic names. That should come in as a default when you select entire column for name.
# October 24, 2005 2:40 PM

Alexandre Roum said:

Can you make a simple Excel 12 document available to us - real Excel generated file.
Samples are great but it would give us a better fill for the format.
Brian did that for Word some months ago and it helped a lot. Thanks.
# October 24, 2005 2:49 PM

Biff said:

"I find it incredibly frustrating when named ranges are used for almost everything. Whilst it may make understanding formulae easier (IF sensible names are used following a consistent convention). However, for auditing formulae I find it more of hindrance because you cannot the identify ranges used. "

I couldn't agree more.

# October 24, 2005 5:12 PM

Colin Banfield said:

<<"I find it incredibly frustrating when named ranges are used for almost everything. Whilst it may make understanding formulae easier (IF sensible names are used following a consistent convention). However, for auditing formulae I find it more of hindrance because you cannot the identify ranges used. "

I couldn't agree more.>>

I use the trace precedent and trace dependent arrows for this purpose but it sounds like what you want is a name/cell reference display toggle like the A1/R1C1 display toggle or the cell result/formula display toggle.

Colin
# October 24, 2005 7:21 PM

David Gainer said:

Thanks everyone for the comments and discussion and feedback on hidden names.

Rob - The in use-column indicates whether a name is being referenced in a cell, or by another name in the active workbook. It doesn’t look at the following to determine if a name is in use or not:
- names that are referenced as strings via INDIRECT (not parsing this string)
- names that are referenced in VBA (not possible to parse the code manually and accurately pull out defined names).
- names that are referenced by other workbooks (external references)

Hazz – The current limit is ~1,000. Also, the New/Edit Name dialog is resizable, thanks for helping me point that out. 3D ranges for SUMPRODUCT has not changed from Excel 2003.

Jean, Gary, Tianwei – what is the scenario you have in mind when you say “dynamic ranges”? I will be talking about some work we have done around tables starting tomorrow that might be helpful to you.

Harlan – Yes, you diehard keyboard users will still be able to create worksheet-scoped names the way you do today. We are very aware of keyboard users on the Excel team. We have not changed the limit for defined names in Excel 12.

Jim – The current design does not allow users to create hidden names. The goal of that filter option is to help users troubleshoot their workbooks (hidden names copied over from other workbooks can cause problems and this would allow saavy users to find those names and remove them if necessary). I understand, however, the concern of developers who use hidden names in their apps not wanting customers to have control over them. Thanks for the feedback on the scope drop down. One goal of this dialog was to allow users to do workbook-level operations, but yoru point is well taken.

Jan Karel – Thanks for the suggestions.

Roger – You can manually paste the “refers to” contents into the name comment, but there is no way to link them. You can type pretty much whatever you want into the comment box – is that what you meant by customise?

Mpemba – Yes, the name drop-down will be wider by default and resizable. See my post on the formula bar.

Tianwei - Stay tuned for upcoming posts on tables. Then let me hear if we have addressed your scenario around names for column headings.

Alexandre - Just to make sure I understand, do you mean you would like a sample of the file format?
# October 24, 2005 8:43 PM

Harlan Grove said:

Should have thought to ask this before - will the new Manage Names dialog show worksheet scope names in VERY hidden worksheets?
# October 25, 2005 4:02 AM

Roger Crawley said:

David,

What I meant by customise was a group of radio buttons within the Name Manager so that each user could decide what they want the Name Comment to tell them.

Is there no way of programming the Name Comment to reflect the current "refers to" property? A manual paste solution is fine on the rare occassion that a worksheet is not going to have any rows/columns inserted/deleted.
# October 25, 2005 5:01 AM

Nigel Harper said:

Dave,

Thanks again for giving us our daily bread in the way of this blog.

I disagree with Jim Rech about the scope suggestions both in creating new ones and showing existing ones in the new UI. When a name is created I often want to create the same name, say on 12 sheets for the months of the year. We should be able to create a name once but make it local to one or any number of specific sheets at the same time by some sort of checkbox list. However I agree that we don't necessarily want a list of a zillion names so the Filter should be able to show:
'Names Scoped to Activesheet'
'Names Scoped to All Worksheets'
'Names Scoped to Workbook'

For dynamic named ranges (especially those using formulas to construct addresses and refer to them via the INDIRECT function) it would be very useful to have displayed the RefersToRange property somewhere in the UI.

Also, the UI must have a way of excluding some names from the general users view. I agree that we should be able to create and hide a name via the UI, but I also concur that a xlVeryHidden VB switch should be included for access via the VBE, I believe this to be very important.

Thank you,
Nigel
# October 25, 2005 5:12 AM

Tianwei said:

"Jean, Gary, Tianwei – what is the scenario you have in mind when you say “dynamic ranges”? I will be talking about some work we have done around tables starting tomorrow that might be helpful to you. "

One of the scenario is charting. When user add data the chart will automatically pick up the data. John Walkenbach has done a wonderful tip here: "http://j-walk.com/ss/excel/usertips/tip053.htm"
Would like to see that as standard.
# October 25, 2005 9:56 AM

Erik Westwig said:

I create hidden names and sheets all the time, so I have mixed feelings about letting users see them. That being said, I find that I'm moving away from xlVeryHidden when I create hidden sheets. It's so much easier to tell a customer how to unhide it, if I want to help them debug some problem on the phone, or whatever. So, with reservations, I think I'd vote for letting the users view the hidden names if they really want to dig.

One thing about names I noticed in previous Excel versions is that the larger the name table gets, the longer it takes to add or remove a single name. I haven't checked this in the most recent Excel versions, but I remember (in Excel 2000?) that the slow down was pretty much linear with the size of the name table. Many times I have started to implement some functionality using hidden names, only to revert to a hidden sheet scheme because I realized I simply had too much data to write, and the slow down was too severe. Eventually, I created a rule for myself that I would never implement any code that required the creation or deletion of more than about 1000 names in a workbook. Of couse I haven't rechecked my rule with newer Excel versions.

All this talk about hidden names and hidden sheets makes me think about what we all seem to use these things for. Their primary purpose seems to be to attach persistence information to cells, worksheet, and workbooks in a way that will update as the user makes changes to the workbook. And in many ways the hidden names and hidden sheets work well. But in many ways they are problematic.

For example, they don't really handle copy and paste very well. If I want to attach some hidden info to a cell, I can do so. But if the user copies and pastes that cell to another location, there is only one hidden name. To get around this problem, I've play with things like encoding information into a cell's custom formatting fields and similar ridiculous schemes.

What I'd really like to see it an Excel sanctioned method for storing custom data in a cell (or really, with any object. I've played games to store hidden data in drawing shapes too.) This is sort of like the old "BigData" structure in the XLL interface. But unlike "BigData" there would hopefully be a way to keep references and formulas updated as the user made changes to their model. And the data could get copied when the object was copied, etc.

Just a thought...
# October 25, 2005 2:11 PM

David Gainer said:

Harlan - No, it wont.

Roger - If you are ok writing some VBA, you could put pretty much anything you want in the comment, including the name's refer to.

Nigel - Thanks for the feedback.

Tianwei – Great. We have exactly the solution for you in Excel 12 – see most recent post (“Tables Part 1”) … more details on how this works coming later this week.

Erik – Thanks for your feedback. Custom data isn’t something that have addressed directly in Excel 12, but it is on my list of things to think about for future versions.
# October 25, 2005 11:21 PM

Stephen Bullen said:

Name dialog: Please also show the Refers To for each name as a column in the box, so I don't have to select a name to see what it refers to. Most of the time (as a developer) I'm much more interested in its Refers To formula than its value or comment.
Name comments: It would find them most useful if the Filter dropdown could filter on a textual wildcard match of the comments. I could then use the comment for categorisation of names, or if I'm including change logging, I could easily find the name(s) I changed yesterday. Lastly, in most cases, the comment would be for the developer, not the end-user, so I wouldn't want the comment (for a specific name) to appear as tooltips etc.
# October 31, 2005 8:10 AM

Microsoft Excel said:

Today's author, Charlie Ellis, a Program Manager on the Excel team, shares a spreadsheet he built in

# September 30, 2008 2:02 AM
New Comments to this post are disabled
Page view tracker