Max If Array

Robby19

Board Regular
Joined
Mar 19, 2018
Messages
227
Good day again,

I need to find the Max volunteered hours for each unit. I believe this is going to be an array, but could someone help me put it together.
Data Table
UnitEmployeeTotal Volunteer Hours
1a12
2a24
1b57
1c35

<TBODY>
</TBODY>

The result table should look like
UnitEmployeeTotal Volunteer Hours
1b57
2a24

<TBODY>
</TBODY>


I may also need to figure out if 2 or more people from the same unit have the same amount of hours. If that is the case the result should be
UnitEmployeeTotal Volunteer Hours
1b, d57
2a24

<TBODY>
</TBODY>
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Looking at your signature and on the assumption you're happy to use helper columns then something like this:


Book1
ABC
1UnitEmployeeTotal Volunteer Hours
21a12
32a24
41b57
51c35
61d57
73a13
83b22
93c45
103d34
113e45
123f45
133g45
Sheet1



Book1
ABCDEFGH
1UnitTotal Volunteer HoursEmployee
2157b,d,b,d
3224a,a
4345c,e,f,g,c,e,f,g
Sheet2
Cell Formulas
RangeFormula
C2=MID($D2&$E2&$F2&$G2&$H2,2,1024)
D2{=IFERROR(","&INDEX(Sheet1!$B:$B,SMALL(IF(Sheet1!$A:$A=$A2,IF(Sheet1!$C:$C=$B2,ROW(Sheet1!$B:$B))),COLUMNS($D2:D2))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.


Copy formula in D2 across to H2 and down as far as necessary.

WBD
 
Upvote 0
The above Array does not seem to work for me. I can get the MAX IF hours, however the name of the person for those hours does not match up. Below is my version for the spreadsheet.

Code:
{=IFERROR(INDEX(Hours[Full Name],SMALL(IF(Hours[Unit]=[@[Unit Name]],IF(Hours[Total Volunteer Hours]=[@[Total Hours]],ROW(Hours[Full Name]))),COLUMNS([Full Name]))),"")}

Not sure if I did something wrong or not.

EDIT: I removed the "," since I don't need to see the comma in the formula.
 
Last edited:
Upvote 0
That bears little resemblance to what you originally posted. Can you post your actual data?

WBD
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,395
Members
449,446
Latest member
CodeCybear

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