{"id":1075,"date":"2011-04-20T13:07:56","date_gmt":"2011-04-20T19:07:56","guid":{"rendered":"https:\/\/www.vertex42.com\/?p=1075"},"modified":"2021-10-30T11:07:53","modified_gmt":"2021-10-30T17:07:53","slug":"creating-business-forms-with-customizable-lists","status":"publish","type":"post","link":"https:\/\/www.vertex42.com\/blog\/help\/excel-help\/creating-business-forms-with-customizable-lists.html","title":{"rendered":"Creating Business Forms with Customizable Lists"},"content":{"rendered":"<p>Spreadsheets are great tools for creating business forms such as <a href=\"\/ExcelTemplates\/invoice-templates.html\">invoices<\/a>, <a href=\"\/ExcelTemplates\/excel-purchase-order.html\">order forms<\/a>, or <a href=\"\/ExcelTemplates\/excel-expense-report.html\">expense reports<\/a>. If you use a form like this routinely, you may come across times when it would be handy to select items from a drop-down list and have other information update automatically. Let me give an example ...<\/p>\n<p>Today I added a new <a href=\"\/ExcelTemplates\/excel-purchase-order.html\">purchase order template<\/a> to my website that includes a customizable price list. Instead of manually entering the description, item #'s, and prices, you can select an item from an <a href=\"\/blog\/help\/excel-help\/create-a-drop-down-list-in-excel.html\">Excel drop-down menu<\/a> as shown in the image below:<\/p>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-1076\" title=\"Purchase Order Template with Drop-Down Box\" src=\"\/blog\/wp-content\/uploads\/purchase-order-product-selection-dropdown.gif\" alt=\"Purchase Order Template with Drop-Down Box\" width=\"493\" height=\"153\" srcset=\"https:\/\/www.vertex42.com\/blog\/wp-content\/uploads\/purchase-order-product-selection-dropdown.gif 493w, https:\/\/www.vertex42.com\/blog\/wp-content\/uploads\/purchase-order-product-selection-dropdown-180x55.gif 180w, https:\/\/www.vertex42.com\/blog\/wp-content\/uploads\/purchase-order-product-selection-dropdown-300x93.gif 300w\" sizes=\"(max-width: 493px) 100vw, 493px\" \/>\n<p>The list can be customized in a separate worksheet as shown in the following image:<\/p>\n<img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/purchase-order-price-list-worksheet.gif\" alt=\"Purchase Order Price List Worksheet\" title=\"Purchase Order Price List Worksheet\" width=\"469\" height=\"188\" class=\"alignnone size-full wp-image-1077\" srcset=\"https:\/\/www.vertex42.com\/blog\/wp-content\/uploads\/purchase-order-price-list-worksheet.gif 469w, https:\/\/www.vertex42.com\/blog\/wp-content\/uploads\/purchase-order-price-list-worksheet-180x72.gif 180w, https:\/\/www.vertex42.com\/blog\/wp-content\/uploads\/purchase-order-price-list-worksheet-300x120.gif 300w\" sizes=\"(max-width: 469px) 100vw, 469px\" \/>\n<p>In this case, the purpose isn't just to select items from a list. We want the Item # and the Unit Price to update automatically based on whatever item was selected.<\/p>\n<h2>How It's Done<\/h2>\n<p>I'm going to give a general outline for how this is done. There are basically 3 steps:<\/p>\n<h3>#1 - Create the List<\/h3>\n<p>This part's easy. Just add a worksheet and put some labels at the top of the columns and start adding data, just like in the PriceList worksheet shown above.<\/p>\n<h3>#2 - Add a Drop-Down List to Your Form<\/h3>\n<p>To create the drop-down list, we can use the Data Validation feature in Excel. For detailed instructions on this procedure, see my article <a href=\"\/blog\/help\/excel-help\/create-a-drop-down-list-in-excel.html\">Create a Drop-Down List using Data Validation<\/a>. (You'll need to review that article to understand the rest of this post). The important thing to get out of that article is that you need to use a named range if your customizable list is on a separate worksheet.<\/p>\n<p>You don't have to be fancy with your named range. In the price list example above, I could define the range as <code>=PriceList!$A$1:$A$300<\/code>, but then I'd end up showing 300 rows in my drop-down list instead of just the 6 I needed (the rest of the 294 rows would be blank). Or, I could define it as <code>=PriceList!$A$1:$A$6<\/code>. In that case, when I edited the price list, I'd need to make sure to either insert rows above A6 or change the definition of the named range after adding on to the end of the list. In a template, that can of editing is usually a bit much to ask of the user.<\/p>\n<p>A more advanced technique, which also makes things easier for the user, is to use something we call a <em>dynamic named range<\/em>, or a range that adjusts its size automatically. In this case, we want the range to extend only to the last non-blank row from our price list. So, we use a formula like this for the named range: <code>=OFFSET(PriceList!$A$1,0,0,MATCH(REPT(\"z\",255),PriceList!$A:$A),1)<\/code><\/p>\n<p>If you want to learn more about that technique, see the article <a href=\"\/blog\/excel-formulas\/dynamic-named-ranges.html\">Formulas for Dynamic Named Ranges<\/a>.<\/p>\n<h3>#3 - Automatically Add the Item # and Unit Price<\/h3>\n<p>To populate the Item # and Unit Price columns based on what we select from the drop-down list, we can use the LOOKUP() or INDEX(MATCH()) techniques. I prefer the INDEX(MATCH()) approach. The formula for the Unit Price looks like something like this<br \/>\n<code>=INDEX(PriceList!C:C,MATCH(B21,PriceList!A:A,0))<\/code><\/p>\n<p>In English, this is effectively saying \"Select the unit price from the PriceList worksheet where the corresponding description matches what we just selected from the drop-down list\".<\/p>\n<h2>Other Examples<\/h2>\n<p>If you'd like to see examples in spreadsheets that you can download for free, you can take a look at the <a href=\"\/ExcelTemplates\/money-management-template.html\">money management template<\/a> and <a href=\"\/ExcelTemplates\/meal-planner.html\">meal planners<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you use an invoice or order form in Excel routinely, you may come across times when it would be handy to select items from a drop-down list and have other information update automatically. Here is an example.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[37],"tags":[],"class_list":{"0":"post-1075","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-excel-help"},"_links":{"self":[{"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/posts\/1075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/comments?post=1075"}],"version-history":[{"count":0,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/posts\/1075\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/media?parent=1075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/categories?post=1075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/tags?post=1075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}