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
[TABLE="width: 500"]
<TBODY>[TR]
[TD]Unit[/TD]
[TD]Employee[/TD]
[TD]Total Volunteer Hours[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]a[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]a[/TD]
[TD]24[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]b[/TD]
[TD]57[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]c[/TD]
[TD]35[/TD]
[/TR]
</TBODY>[/TABLE]

The result table should look like
[TABLE="width: 500"]
<TBODY>[TR]
[TD]Unit[/TD]
[TD]Employee[/TD]
[TD]Total Volunteer Hours[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]b[/TD]
[TD]57[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]a[/TD]
[TD]24[/TD]
[/TR]
</TBODY>[/TABLE]


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
[TABLE="width: 500"]
<TBODY>[TR]
[TD]Unit[/TD]
[TD]Employee[/TD]
[TD]Total Volunteer Hours[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]b, d[/TD]
[TD]57[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]a[/TD]
[TD]24[/TD]
[/TR]
</TBODY>[/TABLE]
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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