Help with a function

Bmaho

New Member
Joined
Sep 6, 2017
Messages
13
I have a project I am working on for my class and I am having trouble with this question. Below I am posting the actual question, the worksheet with the database, and the worksheet where I will be placing the macro button that will bring up the input box for the user to input information. What I am trying to do first is record a macro beginning in the answer worksheet, because that's where my answer needs to go, that gets the percentage of employees from the accounting department that makes more than 45,000. Then I think I can replace "accounting" with input box. As you can see below, the answer worksheet has a cell for the answer, and the criteria for the question is the headings copy/pasted from the database. the database begins with Emp ID in A7 and the column for years in service goes to J61.

1. Create a macro, Q_1, which will ask the user for the department of an employee and then calculate percentage of employees from that department who are earning above $45,000 among all employees in the database? Set up criteria on Queries worksheet, and answer should be on Queries sheet in the cell indicated. Create two macro buttons, one each on Database and Queries sheet. Macro should be self-sufficient including first clearing the criteria range.

The paragraph above is the question, and below is the database wordksheet.


Emp IDLast NameFirst NameDepartmentDivisionSalaryStart DateBirth DateAgeYears In Service
1011GortonHazelAccountingCopier$27,597.85 2/3/200011/21/19645318
1012PrestonLizaEngineeringPrinter$43,394.15 1/26/200612/2/19843312
1041TercanRobertR and DPrinter$28,043.68 4/16/20029/21/19655215
1054SmithHowardArtCopier$25,176.06 4/16/20098/9/1987308
1055AlbertMaxineMarketingCopier$26,040.56 4/8/19998/20/19675019
1075KaneSherylArtPrinter$23,239.44 8/7/20068/28/19793811
1152HendersMarkAccountingPrinter$26,646.20 1/21/200010/23/19714618
1153PlantAllenAccountingPrinter$28,043.68 1/13/200911/3/1963549
1167BerwickSamMarketingCopier$31,913.88 4/18/20019/28/19704716

<colgroup><col><col><col><col><col><col><col><col><col span="2"></colgroup><tbody>
</tbody>

And below is the answer worksheet.

Q1Put your answer in this cell
Emp IDLast NameFirst NameDepartmentDivisionSalaryStart DateBirth DateAgeYears In Service

<colgroup><col><col><col><col><col><col><col span="2"><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Oh, and when I said I can replace "Accounting" with input box, I am referring to editing the macro code in VBA
 
Upvote 0

Forum statistics

Threads
1,213,565
Messages
6,114,337
Members
448,568
Latest member
Honeymonster123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top