Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel combo Box referencing 1

Status
Not open for further replies.

WJT19

Computer
Jun 20, 2003
4
How do you reference to a combo box, its hard to put into words I will explain what Im doing.

Im making a spreadsheet for a company, they need all there expenses for each day listed and they have several (around 20) catergories ranging from motoring to rent, ext. I need to spreadsheet to look in each combo box and when the box says motoring, I want it to pull the amount payed from the cell next to it and put in into a different page to be totalled.

can anyone help?

THANX
WILL
 
Replies continue below

Recommended for you

Here is a solution if what you want is just the total for each category. First off, say this is your data, with a combo box on each row in column B, and column C is the "linked cell" for the combo box selection (you can hide Col C if you want):

A B C
R1 Amount Pick A Category Category
R2 $10 <combo box> Rent
R3 $15 <combo box> Motoring
......etc.
R100 $25 <combo box> Motoring

Next define some names. Create the name VALUES for the range A2:A100. Create the name CATS for the range C2:C100.

To compute the total rent, use the following array formula:
=SUM(IF(cats=&quot;rent&quot;,1,0)*values)
**Remember to press CTRL-SHIFT-ENTER when entering this array formula, which will add the symbols { and } around the formula.
={SUM(IF(cats=&quot;cat1&quot;,1,0)*values)}
This formula works by &quot;zeroing out&quot; the values for the categories you are not interested in, leaving an array of 1s and 0s multiplied by the array of values, then summing the range of values that remains.

Repeat the above formula for each category.

Hope this helps!
 
Another trick that might work is Data Validation.
First define the list of options (motoring...rent...???)with a name (Insert - Name - Define) somewhere on one of your worksheets, which can then be hidden.
On the sheet where people enter their expenses, highlight the cells than select Data - Validation... Under Allow: select list. For Source: enter =name (whatever name you used previously). There are options for prompt boxes too.
You can then reference the input cell as with any other. Hopefully you can follow this, I find this approach easier and more user-friendly than adding combo boxes to a worksheet, but hey, whatever works.
 
Similar to first response :
Use combo box from forms toolbar.
Right click, format control, control tab and set up list range and I usually put the cell link to the cell behind the combo box - when they select item 5 on the list, the cell hidden behind the combobox now contains the number 5 (obvious but making sure we're on same wavelength here!).
On next worksheer, or wherever then use the sumif satement to collect all values with value = 5 (say) in the columns containing the combo boxes.
Column A Column B
<combobox> Value
<combobox> Value

To total : =sumif(A1:A10,&quot;=5&quot;,B1:B10)
Checks if value in column A is 5, if so, add number in column B to total.

As usual in Excel, many ways to do the same thing. Data validation with list option works just as well except now use the sumif statement with &quot;=motor&quot; or whatever category.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor