Help with a nested function

Bmaho

New Member
Joined
Sep 6, 2017
Messages
13
I have a project I'm working on for class. I have a workbook with two sheets, one is a database and the other is where I am submitting my answers. The database is a list of employees with that looks like this, but longer:
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/19655216

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

I am recording a macro that will allow a user to calculate the percentage of employees from a specific department that have salaries over $45,000 among all employees in the database. Is there a nested function that will allow me to calculate this to the answer sheet?





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

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
if the sample data you provided sat in the range A1:J4, then ...

in N2 enter the following as an array formula (ctrl, shift, enter) ... =INDEX($D$2:$D$4,MATCH(0,COUNTIF($N$1:N1,$D$2:$D$4),0)) ... you'll need to change $D$4 to whatever cell is the bottom of your list, and drag down as far as is needed to display all possible department names

in O2 enter the following ... =COUNTIFS($D$2:$D$4,N2,$F$2:$F$4,">45,000")/COUNTIF($D$2:$D$4,N2) .. you'll ned to change $D$4 and $F$4 to whatever cell is at the bottom of your list, and drag down as far as you need

be sure to format column O as percentage

Kind regards,

Chris
 
Upvote 0
Hi Chris,

Thank you for your help, it is very much appreciated. I am not familiar with the index function. I am going to try the way you mentioned right now, but is there a way to do it using a nested function with DGET, or a nested IF function?

if the sample data you provided sat in the range A1:J4, then ...

in N2 enter the following as an array formula (ctrl, shift, enter) ... =INDEX($D$2:$D$4,MATCH(0,COUNTIF($N$1:N1,$D$2:$D$4),0)) ... you'll need to change $D$4 to whatever cell is the bottom of your list, and drag down as far as is needed to display all possible department names

in O2 enter the following ... =COUNTIFS($D$2:$D$4,N2,$F$2:$F$4,">45,000")/COUNTIF($D$2:$D$4,N2) .. you'll ned to change $D$4 and $F$4 to whatever cell is at the bottom of your list, and drag down as far as you need

be sure to format column O as percentage

Kind regards,

Chris
 
Upvote 0

Forum statistics

Threads
1,215,417
Messages
6,124,777
Members
449,187
Latest member
hermansoa

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