×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Choosing & Adding Six Numbers from Eight in Excel

## Choosing & Adding Six Numbers from Eight in Excel

(OP)
A pal of mine would like to have a list of runners in the left-hand column and in each of the next eight columns would be the event placings for eight different races. From these eight positions he would like to select only the first six placings and total them

We decided that he would need to use SUMIF. However we cannot figure out how to setup the criteria for such a calculation. Does anyone know how this can be done? The names of each runner must be down the left-hand side.

Any help would be nice

Regards

Tarquine

### RE: Choosing & Adding Six Numbers from Eight in Excel

=SUMIF(B1:B8,"<6")
so you would get a total at the bottom of each column then total or whatever all of the columns
Maybe????

### RE: Choosing & Adding Six Numbers from Eight in Excel

(OP)
Ah! I think I didn't explain this correctly. Each competitor will receive some points between 0 and 200. The competitor's names must be down the left-hand side, see below for example:

Names Loc1 Loc2 Loc3 Loc4 Loc5 Loc6 Loc7 Loc8 Total

Fred 60 52 150 25 25 132 78 65
Harry 75 200 175 30 0 67 190 185
Tom 169 93 115 95 165 100 150 111
Etc (imagine that the numbers line up under each heading)

The loc will donate the venues. What we are trying to do is take the top 6 races, from a possible 8 races, for each competitor, total them and place the result to the right-hand side of the row. Of course we cannot sort them on this page as it cause the results to get messed up.

I hope this makes it a lot clearer and you can provide me with an answer.

Regards

Tarquine

### RE: Choosing & Adding Six Numbers from Eight in Excel

You will need a area of your spreadsheet set up for intermediate calculations. You could use any place on this sheet, or even another sheet. I think you could then write a macro that would sort each line individually in the intermediate area and leave the original data unsorted; however the following method should give you the results you want without a macro.

For this example, I am inserting 11 columns between Loc8 and Total (J through T).
After the formulas are all entered, you can then hide these columns. You could also put these columns elsewhere as mentioned above, and adjust the formulas accordingly.

J: =MINA(B2:I2) *** find first minimum value
K: =COUNTIF(B2:I2,J2) *** count occurrences of this minimum value
L: =IF(B2=$J2,300,B2) *** get Loc1 value unless it is the min. value, in which case make it a large value (i.e. 300) M through S: *** copy column L into these columns. T: =MINA(L2:S2) *** find minimum value of new table. U (Total column): =SUM(B2:I2)-(IF(K2>=2,J2*2,J2+T2)) *** This takes the sum from the original row, subracts from it either: (first min. * 2) if 2 or more occurrences, or if only 1 occurrence, subtracts (first min + 2nd min). This will give the total of the top 6 values for this row. You can then copy J through U down as far as you need to cover all runners. ### RE: Choosing & Adding Six Numbers from Eight in Excel (OP) Many many thanks for your suggestion. I have made up a spreadsheet using your instructions and the results appear to be exactly what we were looking for. Once again thanks for taking the time out to answer my questions. Regards Tarquine ### RE: Choosing & Adding Six Numbers from Eight in Excel (OP) Ah! I think I might have been a bit premature with my praise. When I said that I had placed it into a spreadsheet I should have said that it was in Excel 2000. And yes it works a treat. However, if the same is attempted in Excel 97 then it will not accept MINA(L2:S2) as a valid value. At least that is what Excel 2000 says when I try to save it that format. I have tried to carry out the same instructions using Excel 97 and there appears to be a problem in that all the values in columns M through S return the row one value all the way down that column. Is this correctable or should I get my pal to spend a bit more money and purchase the latest edition:-) Regards Tarquine ### RE: Choosing & Adding Six Numbers from Eight in Excel Tarquine: I used Excel97 myself to set up and test this, so it should work. The first thing to check if it is always bringing in the first row values when you copy it down is where the$ sign is in the formula.
=IF(B2=$J2,300,B2) is the correct formula: the$ before J column tells it to always refer to J column even when copied elsewhere. Make sure that a $did not also get in front of the 2 which would always refer to the second row instead of the same row relative to it's current position. The other columns on row 2 should also read$J2 in the formula after copying, but the 2 should automatically change to the current row as you copy it down if there is no \$ in front of the #.
I have not used Excel 2000, so have no idea why 'Save As' might give problems.
Check this and let me know,
dsawford

### RE: Choosing & Adding Six Numbers from Eight in Excel

(OP)
Ok! You win:-) I had followed your instructions to the letter and for some reason the computer with Excel 97 on it was not refreshing correctly. After I had sorted that bit out all was well.

Again many thanks for the answer my query.

Regards

Tarquine

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!