Form Controls – Adding Interactivity to Your Worksheets

Share

Facebook
Twitter
LinkedIn

Form Controls

What Are Form Controls?

Form Controls are objects which you can place onto an Excel Worksheet which give you the functionality to interact with your models data.

You can use these controls on worksheets to help select data. For example, drop-down boxes, list boxes, spinners, and scroll bars are useful for selecting items from a list. Option Buttons and Check Boxes allow selection of various options. Buttons allow execution of VBA code.

By adding a control to a worksheet and linking it to a cell, you can return a numeric value for the current position of the control. You can use that numeric value in conjunction with the Offset, Index or other worksheet functions to return values from lists.

Use below links to quickly learn about Form Controls:

Where Are Form Controls?

Form Controls are located on the Developer Tab under Insert Form Control.

PS: If you do not have developer tab, learn how to enable it.

You will notice 2 types of Form Controls, being Form Controls and Active X controls.

This post will only be dealing with Form Controls. The Active X controls, similarities and differences will be discussed towards the end of the post.

How Do I Insert a Form Control

To Insert a Form Control goto the Form Control Menu and click on the Form Control you want to insert.

Now click on the worksheet in the location you want your form control.

Don’t worry about the location or size you can change those later.

 

What Are The Different Form Controls?

There are several types of Form Controls offering a range of interactivity from a simple display through to interactive controls which allow multiple selection or interactive selection of values.

Control Name Description Function
Button Push Button Executes a macro
Check Box Allow selection of non-exclusive options Multiple On/Off options
Combo Box Drop Down selection Box Select items from a Drop down list
Group Box Layout element which groups common elements Nil
Label A Text label Can be static or linked to a cell
List Box Fixed selection box Select items from a list
Option Button Allow selection of exclusive options Exclusive Single On/Off option
Scroll bar Allow Horizontal or Vertical scrolling Increases or decreases a cells value by a fixed amount
Spin Button Increment/decrement a value by a fixed amount Increases or decreases a cells in steps by a fixed amount

These are discussed individually below

Form Control Types

 

Button (Form Control)

 

The Button Form Control is as its name suggests simply a Button.

Pressing the Button allows execution of a macro.

The Button has no other controls.

Button Text

You can right click on the button and change the buttons Text (Edit Text) and enter the text you want displayed on the button.

The Button’s text can be linked to a cell, select the Button, In the formula Bar enter a link to a cell. eg: =$C$3 and accept. The Button’s text will now change as the contents of the cell C3 change.

You can change the Text Style including Font, Color and Text Direction using the Format Control  (Ctrl 1) option.

Assign Macro

Right click on the Button and select Assign Macro

The Assign Macro dialog will pop up.

Select the macro you want to assign to the button.

Label (Form Control)

The Label Form Control is also as its name suggests simply a Label.

The Label will display text either fixed or from a linked cell

You can right click on the button and change the buttons text (Edit Text).

The Button’s text can be linked to a cell, select the Button, In the formula Bar enter a link to a cell

eg: =$C$3 and accept. The Button’s text will now change as the contents of the cell C3 change.

Unlike the Button you cannot change the Text Style, Font, Color or Text Direction.

Typically a label is put in front of another Control to explain or add a title to the control.

Labels would rarely be used on a Worksheet as a label as they have limited text format properties.

Users would be better served using either cell text or a Text Box where full text formatting is allowed.

Labels come into use when setting up custom Dialog Forms which are used by VBA applications for custom data entry or other uses.

 

Check Box (Form Control)

The Check Box form Control allows selection of a number of non-exclusive options.

That is any number of Check Box controls may be implemented and they independently be on or off and have no relationship to each other.

The Check Box Form Control returns the value indicating its status, either True (selected) or False (not selected),  to a linked cell.

To link a Format Control to a cell, Right Click the Format Control and select Format Control…

Option Button (Form Control)

The Option Button form Control allows the selection of an exclusive option from a number of alternatives.

That is only one Option Button Form Control may be selected at a time, the remainder are automatically turned off.

The Option Button Form Control returns the value of the Option Button indicating its status to a linked cell.

In the Example above the Option Buttons are linked to cell E2.

You only need link one Option Button to cell E2, Excel automatically links the remaining option buttons to teh same cell.

Selecting a Different Option Button automatically deselelects the other Option Buttons and changes the linked cells value

List Box (Form Control)

The List box allows the selection of one or more items from a list.

The list is sourced from a Range of cells in the above case it was F2:F17.

The List Form Control returns an Index Number or position of the selected item to the Cell Link, 5 in the example above.

The Input Range and Cell Link are setup by Right Clicking the control and select Format Control…

The Number of items visible in the list box is determined by the size of the list box

If there are more items than will fit in the list box then a scroll bar is automatically added to the list box to enable there selection.

Combo Box (Form Control)

The Combo Box allows the selection of one or more items from a drop down list.

The Combo Box use is similar to the list box except that it has a drop down selection list instead of a fixed length selection list.


The list is sourced from a Range of cells in the example below it was F2:F17.

The List Form Control returns an Index Number or position of the selected item to the Cell Link B10, 9 in the example below.

The Input Range, Cell Link and size of the Drtop Down Box are setup by Right Clicking the control and select Format Control…


Spin Button (Form Control)

The Spin Button is a simple toggle button that allows the increase or decrease of a linked cells value by a certain pre-defined amount.

The Cell Link and Lower, Upper Limits and Step Size parameters are setup by Right Clicking the control and select Format Control…

The Lower, Upper Limits and Step Size must be Integers. If you want to increase a cell by fractional amounts you will need to for example set the range from 0 to 1000 in steps of 1 and then devide the linked cell by 10 which will give a Range of 0 to 100 in steps of 0.1

Scroll Bar (Form Control)

The Scroll Bar Form Control often referred to as a Slider is a simple linear slider that allows the increase or decrease of a linked cells value by sliding a bar either left/right or up/down.

Scroll Bars can be placed either Horizontally or Vertically by dragging the corner.

Scroll bars are incremented by the Step Size by clicking the ends of the bars or dragging the slider or by a Page Jump Size by using Page up[/down or clicking either side of the slider bar.

The Cell Link, Lower, Upper Limits, Incremental Change and Page Change parameters are setup by Right Clicking the control and select Format Control…

The Lower, Upper Limits, Incremental Change and Page Change must be Integers. If you want to increase a cell by fractional amounts you will need to for example set the range from 0 to 1000 in steps of 1 and then devide the linked cell by 10 which will give a Range of 0 to 100 in steps of 0.1

Group Box (Form Control)

The Group Box Form Control isn’t really a Form Control at all, as it allows no interactivity.

What it is used for is grouping similar controls so that functional groups of controls can be maintained and the users flow is directed around a form.

Using the Form Controls

General Use

The use of the information from a form control is limited by your imagination.

Typical uses are

  • Selecting items for a chart
  • Selecting data sets
  • Moving data sets
  • Adjusting values in a model

As described in each of the above Form Controls is that the Form Controls do not return a value directly from a list, they all return either a number or an index number relative to the position of the item in a list.

Examples of all the Form Controls and examples of their use can be found in the attached file:

Excel 2003 Examples or Excel 2007+ Examples

or

Have a browse through the dashboards presented during Dashboard Week

or

For some Extreme Examples of Spreadsheet Interactivity using Form Controls and a little bit of VBA code:

ExcelHero.com

Running Macros

Apart from the Button Form Control whose only purpose is to Run Macro’s, all Form Controls can be linked to a Macro.

This is done by Right Clicking on the Form Control and selecting Assign Macro.

It is worth noting that the macro is only executed after the control is released.

EG: If you have a macro linked to a Spin Button, If the Spin Button is held down and hence repeatedly increments its value, the macro will only be executed after the control is released.

 

Moving and Resizing Form Controls

You can move and resize form controls as with all other worksheet Objects.

Select the form control by right clicking on it

Use the handles to resize or drag the edges to move the controls

Hint: You can use Alt while dragging or resizing to snap the control to cell boundaries.

3D, Printing & Locking Form Controls

You can lock Form Controls as well as enable them to be printed or not

Right Clicking the control and select Format Control…

Use the Size, Protection and Properties Tabs as required.

The 3D option enables a 3D version of the Control instead of a flat control, which can add a bit of sparkle in some instances.

Limitations of Form Controls

Form controls offer a limited set of functions but do those functions very well.

Limitations are Form Controls:

  • Form Controls can only increase or decrease by integer numbers
  • Form Controls only return the index of an item in a list
  • Form Controls have limited format properties (Font, Color etc)

What are the Active X Controls

Active X controls are like Form Controls on Steroids in that they have a much wider range of properties than Form Controls.

They also have much better ties to VBA in terms of programmability and have a number of events that can be accessed programmatically.

The main limitation of Active X controls are that they use a Microsft Active X component. This means that if you are sharing your workbook with an Apple Mac user using Excel for Mac  these functions wont be available as Active X isn’t avilable on that Platform.

Workbooks with Form Controls will happily work on a an Apple Mac.

Other Controls Available in Excel

A number of other Excel objects can be used to add interactivity to your worksheets.

Shapes

These include:

  • Shapes
  • Charts
  • Text Boxes
  • Word Art

All these can have macro’s linked to them which effectively act the same as a Button Form Control without the moving button effect.

A stunning example of using Text Boxes was recently posted at: The Grammy Bump Chart

Where the Artists Stats Box (Top Left of Chart) is using several Text Boxes linked to cells to show the Selected Artsists Statistics.

HyperLinks

Inserting Hyperlinks at stratgic locations throughout worksheets provides a great way to simplify navigation around pages and between pages

Other Links

http://office.microsoft.com/en-us/excel-help/overview-of-forms-form-controls-and-activex-controls-on-a-worksheet-HA010237663.aspx

Where have you used Form Controls ?

Where have you used Form Controls?

Let us know in the comments below:

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

41 Responses to “How to use Excel Data Model & Relationships”

  1. Ashish Youngy says:

    Data is Excel 2013 behaves so much like a OLAP cube when using with PivotTables. And this is actually wow. Consider learning not just DAX but MDX too 🙂 Happy Excel

    @Chandoo.. Have a nice and safe time in US. Best Wishes. And when they are publishing your interview in Entrepreneur 🙂

  2. Buzz says:

    I have been using PowerPivot in Excel 2010. My understanding was (via PowerPivot Pro blog) that Power Pivot would NOT be available in Excel 2013 in all versions; my recollection is that it was only going to be available in certain enterprise subscription editions. Thus, for individual users, it will no longer be available? For that reason I have moved some of my projects to Tableau, and do not expect to upgrade to Excel 2013.
    Can you confirm the availability of Power Pivot for all Excel 2013 users , or will it be restricted and unavailable for some users?

  3. Oz says:

    Just this weekend I upgraded from Home Premium to Professional Plus and spent time with Power View and PowerPivot.

    Up to that point I never saw myself in VLOOKUP Hell, and it may not be going away any time soon. I'm surprised to discover how many of my clients are still on Excel 2003. And then I have Mac users who don't have a lot of this great stuff available to them at all.

    These are great features and I'm going to dive into the Data Models. Unfortunately, I suspect, for me, the practical use may be limited to blogposts because I can't teach Power View in my workshops or send a client a spreadsheet that has a Power View in it.

    • thundom says:

      Hi OZ,

      I think the Microsoft would only upgrade the excel to a certain level instead of making it so powerful that it might threat their BI product. You know these "powerful" stuff can be easily done with a entry level crystal reports version.

      Glad to listen to ur opinion on it.

      I spent quite some time and energy on Excel and used it a lot, but now I am focusing energy on BI software like crystal reports.

    • thundom says:

      We both know that based on the technology today. All the time we spend on the Macro and advanced function of Excel can be done easily with other softwares which costs only hundreds of bucks.

      • Hui... says:

        @Thondom
        I don't think Excel tries to be the solver of all problems
        It is a generic tool
        Which for about 95% of people will do what they want 95% of the time
        There will always be specifics where specific custom software will do better than Excel
        It is the commonness of Excel which means that I can send a model to you and it will work , most of the time, that is its strength, of course combined with its flexility in being able to be adapted to suit most needs

        • thundom says:

          Hi Hui,
          You are right.

          But,

          for the business and individual, who spend too much resource on Excel to meet their BI requirements and other processing requests.

          Should they open their eyes to other ways to do it, in this age? Especially for many people try too much time to process stuff with thousands lines of macro programming.

          It is just as when human being created gun fire, the martial arts would not be that effective.

          Ppl need to be prodent when they choose their solution.

          • Hi guys, I just came across your conversation. I have an example of BI vs. Excel stuff. Here in Russia there is an ERP-system called "1C". It became a defacto standart for accounting, planning and BI / analytics. It is positioned as a flexible and powerful system and it really is.
            But its reporting abilities aren't user-friendly (or maybe just not me-friendly).
            Many reports require programming and all those SQL things, so that is common for a company to have a couple of programmers who develop and code those reports.
            So the common solution is to export data to Excel and then process it to be more suitable for further analysis or reporting.
            Well, it's obviously not a rule of thumb that special BI software can outperform Excel in day-to-day routine.

  4. Tris says:

    Hi Chandoo, thanks for publishing great Excel information. Pardon the ignorance as I havent used Data Model nor PowerPivot. But having seen your video clip on PowerPivot, how does Data Model differ from PowerPivot - the "process" seems familiar? Have a great day! And Excel to new heights! Regards,

  5. Nolberto says:

    Excellent posting, some pride themselves for having sheets with thousands of formulas or complicated formulas, but in the end the important thing is to work as little as possible.

    • Oz says:

      @Nolberto let's not gloat yet. Some people are forced to have thousands of complicated formulas when they don't have the fancy tools. I'm sad for the 2003 users who have to use SUMPRODUCT when the rest of us have SUMIFS available.

      In the end, I think the important thing is clean, trustworthy data--however you arrive at it. People survived more than 300 years with slide rules and paper. No PowerPivot for the Wright Brothers.

  6. koi says:

    hi chandoo,

    i added 2 column into sales, 1st column vlookup customer ID to CUST sheet to get the male or female, then 2nd column vlookup Product ID to Product sheet to get the product name, then after that i make pivot table out of sales sheet.

    but then the result is really different from yours

    the purposes is just try to do the vlookup vs add to data model to see if they get same result

    thanks

  7. koi says:

    ups sorry, didnt see that you're filtering using slicer..then it is good now the result are same with less effort 🙂

    thanks

  8. SPrasad says:

    Hi Chandoo, .I am interested to know whether we can build a star schema or snow flake data models through relations in Excel? (trying to correlate with Qlikview)

    • Chandoo says:

      Hi there,

      You can create a Star schema for sure. Snow-flake is possible too. As long as all relationships are one to many (or one to one) anything is possible.

      • Nestavaro says:

        What if customer.profession change its value after sometime?
        Supposed we have monthly data for Sales. What if one customer is a doctor in Feb, then a pilot in October, for example?

        How to build data model for such that situation?

        Thank you.

  9. Raghavendra Shanbog says:

    Hello ,
    I find this option similar to that of MS Access.
    In MS Access as well we have relationship concept and once you create a relationship, you can start creating number of queries based on that.
    But MS Access is not so user friendly and basically its database. Good that we are getting those options/functions in Excel.
    Thanks for sharing this info.

    Regards,
    Raghavendra Shanbog

  10. What is star schema and snow flake.??? Can we have next article on that if it is useful for us???

  11. Roberto says:

    Hi there, can anyone help? I tried testing this out in Excel using two tables. When I go to the Data tab the Relationships button does not appear at all. I am using Microsoft version 14.0.4760.1000, Microsoft Office Professional Plus 2010. Does this version have this capability? Or is there an add-in required?

  12. […] even a layperson can perform if they have the almighty Excel 2010 and PowerPivot installed. Or Excel 2013′s Data Model, which lets you mash up data from Excel Tables and serve them up directly as PivotTables with not a […]

  13. Chandeep Chhabra says:

    Chandoo/Hui,

    The dates grouping feature does not seem to work in Data Model. Is that true or am I making a mistake somewhere?

  14. Jay says:

    I don't think this is really for "lookups"...

    Try creating a pivot with sale ID and customer name in row fields. It will give you ALL customer names per sale ID.

    You'd need to use RELATED function in a new column in powerpivot if you want something equivalent to "vlookup"

  15. Aslam says:

    Please explain the difference between data model and power pivot, the functions of both of them are different and similar
    thanks

  16. […] Handling large volumes of data in Excel—Since Excel 2013, the “Data Model” feature in Excel has provided support for larger volumes of data than the 1M row limit per worksheet. Data Model also embraces the Tables, Columns, Relationships representation as first-class objects, as well as delivering pre-built commonly used business scenarios like year-over-year growth or working with organizational hierarchies. For several customers, the headroom Data Model is sufficient for dealing with their own large data volumes. In addition to the product documentation, several of our MVPs have provided great content on Power Pivot and the Data Model. Here are a couple of articles from Rob Collie and Chandoo. […]

  17. Bernadette Savage says:

    I need to use a slicer to allow a user to select vendor by name. In the background, I need to obtain the vendor ID to link to multiple datasets where the name may not be spelled consistently. Any advice?

  18. Andrea says:

    I've tried this in Excel 2016. It works great.
    I can even create Cube Formulas on the Data model after I've inserted the pivot table.
    Just for the fun of it, I tried to see if I could do Cube Formulas without creating the pivot table in advance. I can define Cube members, but it seems as if the measure part is playing tricks on me.

    I can't get a Cube Value for Chocolates sold to Male customers.
    With the Pivot created the formula looks like this (and works fine)
    =CUBEVALUE("ThisWorkbookDataModel";"[Customer].[Gender].&[Male]";"[Product].[Category].&[Chocolates]";"[Measures].[Sum of Quantity]")

    Does anyone know how I can solve this, or am I asking the impossible?

  19. Kwabena Anaafi says:

    I want to see the video on this topic

  20. nestavaro says:

    What if customer.profession change its value after sometime?
    Supposed we have monthly data for Sales. What if one customer is a doctor in Feb, then a pilot in October, for example?

    How to build data model for such that situation?

    Thank you.

    • Chandoo says:

      In such case, you need to make relationships based on two columns. This kind of feature is not supported in Excel. You can use Power Query to merge tables based on multiple columns and return a consolidated giant table to Excel for reporting.

  21. nestavaro says:

    Is it able in MS Access?
    I have never used access before.

  22. faisal says:

    thanks chandooo your article is very helpfull for troubling peoples' especially in office environment under boss pressure.

  23. Ron says:

    Here is an introduction to PowerPivot.

    The link above is broken

  24. Venkatesh says:

    Hi. This has really taken my interest.. I have huge data tables to work with...and I use vlookup to fetch certain data. I have different data in different sheets...

    Like customer sales (customer code, product code,qty, piece rate, total amount, branch code) data in one sheet
    Branch details in another (branch code, branch address, state , region)
    Customer Geographical Data in third sheet (region, region name)
    Product details in fourth sheet (product code, product description and related)

    Now I use a vlookup to get branch name, state and product name respectively into my main sheet.

    Now what I want is

    customer code, product code,qty, piece rate, total amount, branch code) data in one sheet, branch address, state , region, region name, product description

    Can't his be done thru data model... I tried but it's not working... Eitherway, I will gonthru thr session on e again and give a try... Any help, is appreciated. Thankyou

  25. Achyutanand Khuntia says:

    Dear All,

    i am striving to do reverse relationship in Power pivot ,

    example : -

    1 - Data sheet
    2. - Source data

    step to stops - import first data sheet in power piovt and then source data , made relationship with both sheet , after created relationship i am able to do put related formula in source data sheet only (=releted('Source data'[Amount]), if i go to put formula in data sheet , parameter of Source data are not visible ,

    could someone educate me how can i do , and utilize related formula in data sheet.

Leave a Reply