VBA code to get highest hours value for all duplicate numbers, pls check below table

ashish_RC

New Member
Joined
Sep 9, 2018
Messages
3
NUMBERNAMEHOURSHIGHEST HOURS
9999XXXX2354
6577XXXX4366
6577XXXX6666
9999XXXX2254
6577XXXX5366
6577XXXX2366
9999XXXX5454
6577XXXX6566
9999XXXX2254

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

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Welcome to the MrExcel board!

Do you really need a macro? Could you use one of these formulas, copied down?

Excel Workbook
ABCDE
1NUMBERNAMEHOURSHIGHEST HOURS
29999XXXX235454
36577XXXX436666
46577XXXX666666
59999XXXX225454
66577XXXX536666
76577XXXX236666
89999XXXX545454
96577XXXX656666
109999XXXX225454
Highest Hours
 
Upvote 0
Welcome to the MrExcel board!

Do you really need a macro? Could you use one of these formulas, copied down?

Highest Hours

ABCDE
1NUMBERNAMEHOURSHIGHEST HOURS
29999XXXX235454
36577XXXX436666
46577XXXX666666
59999XXXX225454
66577XXXX536666
76577XXXX236666
89999XXXX545454
96577XXXX656666
109999XXXX225454

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:75px;"><col style="width:57px;"><col style="width:65px;"><col style="width:127px;"><col style="width:43px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
D2=MAXIFS(C$2:C$10,A$2:A$10,A2)
E2=AGGREGATE(14,6,C$2:C$10/(A$2:A$10=A2),1)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Thank you Peter. This solution also helpful for me.

I need to calculate sum of hours where numbers are duplicate and paste the total result in TOTAL HOURS column.

Can I get below result using excel formula?

NUMBERNAMEHOURSTOTAL HOURS
9999XXXX520
6577XXXX1050
6577XXXX1050
9999XXXX520
6577XXXX1050
6577XXXX1050
9999XXXX520
6577XXXX1050
9999XXXX520

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


Regards
Ashish
 
Upvote 0

Forum statistics

Threads
1,215,519
Messages
6,125,298
Members
449,218
Latest member
Excel Master

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