Macro to find 2 lowest scores and sort?

bjbalmforth

Board Regular
Joined
Jul 21, 2005
Messages
117
Here's the problem, players play over 3 rounds but their lowest 2 scores count, EG M Smith row 2 scores of 51 & 36 would be counted.

The other data in cells to the right of score is added to other round information EG, H2+m2, I2+N2, J2+O2, K2+P2.

Once this has been done the information needs to be sorted from the combined data in the order from left to right

Some players may only play 2 rounds thus both the scores would be used,EG it could be from rounds 1 & 3.

I would be guessing that this information would need to be put into columns right of the current data and sorted from there.

I Know this sounds a bit confusing, but it is hard to explain, I hope the table helps solve some of the confusion.
Stableford Social Golf Club.xls
ABCDEFGHIJKLMNOP
1NamesRound 1PLAYED 28-10-2005Round 2Played 10/12/2005Round 3Played 12/03/2006
2R Walker783443482364447336444
3F Fontane80343448036444
4R Jones823733584394447236444
5M Smith824134571364445627333
6R Tallon101483367336444
7Barry J10253447934555510046444
8P Dye111393378439444
B Grade Final Gross Results
 
Try the following...

1) Define the following references...

Insert > Name > Define

Name: Array1

Refers to:

=(Col_1)+(Col_2)+(Col_3)+(Col_4)+(Col_5)

Click Add

Name: Array2

Refers to:

=SMALL(IF(Array1>0,Array1),Col_B)

Click Add

Name: Array3

Refers to:

=MATCH(Array2,Array1,0)*5-5

Click Add

Name: Col_1

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A,,1))*10^9

Click Add

Name: Col_2

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A+1,,1))*10^6

Click Add

Name: Col_3

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A+2,,1))*10^3

Click Add

Name: Col_4

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A+3,,1))/10^3

Click Add

Name: Col_5

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A+4,,1))/10^6

Click Add

Name: Col_A

Refers to:

=ROW(INDIRECT("1:"&INT(COLUMNS(Range)/5)))*5-5

Click Add

Name: Col_B

Refers to:

=ROW(INDIRECT("1:"&MIN(2,INT(COUNT(Range)/5))))

Click Add

Name: Range

Refers to:

=Sheet1!$B2:INDEX(Sheet1!$B2:$P2,MATCH(9.99999999999999E+307,Sheet1!$B2:$P2))

Click Ok

2) Enter the following formula in Q2, copy across and down:

=IF(COUNT(Range)>=5,SUMPRODUCT(SUBTOTAL(9,OFFSET(B2,,Array3,,1))),"")

Hope this helps!

P.S. I just read your last post. Off hand, I don't think I need to make any changes. But I'll have another look at it. In the meantime, I'll email you a sample file.
 
Upvote 0
bjbalmforth said:
Macro only places data after 2 rounds, as people have to play at least 2 rounds, then other data comes after the 3rd round. The Macro searches through the 3 rounds for matches, names must appear at least twice from the 3 rounds.

Since the macro only places the data after 2 rounds, and the other data comes after the 3rd round, I think the following would suffice...

1) Define the following references...

Select/highlight B2

Insert > Name > Define

Name: Array1

Refers to:

=(Col_1)+(Col_2)+(Col_3)+(Col_4)+(Col_5)

Click Add

Name: Array2

Refers to:

=SMALL(IF(Array1>0,Array1),{1,2})

Click Add

Name: Array3

Refers to:

=MATCH(Array2,Array1,0)*5-5

Click Add

Name: Col_1

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A,,1))*10^9

Click Add

Name: Col_2

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A+1,,1))*10^6

Click Add

Name: Col_3

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A+2,,1))*10^3

Click Add

Name: Col_4

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A+3,,1))/10^3

Click Add

Name: Col_5

Refers to:

=SUBTOTAL(9,OFFSET(Range,,Col_A+4,,1))/10^6

Click Add

Name: Col_A

Refers to:

=ROW(INDIRECT("1:"&COLUMNS(Range)/5))*5-5

Click Add

Name: Range

Refers to:

=Sheet1!$B2:$P2

Click Ok

2) Enter the following formula in Q2, copy across and down:

=IF(COUNT(Range)>=10,SUMPRODUCT(SUBTOTAL(9,OFFSET(B2,,Array3,,1))),"")

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,226,812
Messages
6,193,116
Members
453,777
Latest member
Miceal Powell

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