VBA Code to find max value from horizontal text from list having numbers

jackt05

Board Regular
Joined
Feb 1, 2009
Messages
194
Dear All,

I have the following names in a row like below


[TABLE="align: center"]
<tbody>[TR]
[TD="width: 63, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]Sam[/TD]
[TD="width: 63, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]John[/TD]
[TD="width: 63, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]Jack[/TD]
[TD="width: 77, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]George Paul[/TD]
[TD="width: 71, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]Mathew Joy[/TD]
[/TR]
</tbody>[/TABLE]



and I have a table on another sheet where I have the following data,

<!-- Please do not remove this header -->


[TABLE="align: center"]
<tbody>[TR]
[TD="width: 81, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]Sam[/TD]
[TD="width: 63, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] , align: right"]45[/TD]
[/TR]
[TR]
[TD="width: 81, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]John[/TD]
[TD="width: 63, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] , align: right"]60[/TD]
[/TR]
[TR]
[TD="width: 81, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]Jack[/TD]
[TD="width: 63, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] , align: right"]30[/TD]
[/TR]
[TR]
[TD="width: 81, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]George Paul[/TD]
[TD="width: 63, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] , align: right"]85[/TD]
[/TR]
[TR]
[TD="width: 81, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] "]Mathew Joy[/TD]
[TD="width: 63, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] , align: right"]32[/TD]
[/TR]
</tbody>[/TABLE]


As a result in the next column cell I need the name of the highest aged person and in next column cell his age.

as in this case

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]George Paul[/TD]
[TD]85[/TD]
[/TR]
</tbody>[/TABLE]




There is around 2000 rows everyday and Presently I am doing it manually.

If I get a VBA code it would save me a lot of work.

Thanks in Advance

Jack
 
I have shared the sheet to a colleague but he has office 2007. and aggregate function is not working in that office is there any other solution.
Sure. These are array formulas so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Excel Workbook
ABCDEFGHI
1ResultResult
2Name 6Name 2Name 5Name 8Name 7Name 762
3Name 9Name 10Name 15Name 17Name 1Name 1071
4Name 4Name 11Name 16Name 13Name 3Name 369
Sheet3
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Got It,

First did not properly enter.

But got the trick of confirming.

Thanks a lot
 
Last edited:
Upvote 0
Dear Peter,

It is just returning the original list from top to bottom. not the names and "0" for Age.

I have used it as array.

what can be the error in entering.
I'm not sure. You can see that it is working for me. Here is my KM sheet with values entered in column B as Text, which is apparently what you had earlier.

Excel Workbook
AB
1NameAge
2Name 132
3Name 258
4Name 369
5Name 445
6Name 520
7Name 619
8Name 762
9Name 850
10Name 940
11Name 1071
12Name 1133
13Name 1230
14Name 1328
15Name 1441
16Name 1518
17Name 1655
18Name 1717
19
KM



Has your data format changed?

In sheet KM, what does this formula, placed in an empty cell, return =ISNUMBER(B2)
 
Upvote 0
Sorry Peter,

I was not actually entering the formula properly,

Your formula is absolutely correct.

Thanks very much for your support.

Jack
 
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