Formula or Code for writing the difference between the 2 highest number

carole CD

New Member
Joined
Mar 11, 2016
Messages
10
Good afternoon

I need some help with a file (betting scores). I need a formula or some code to be able to calculate the difference between the highest score (column W) and write it in front of the highest score in column Y.
But on the same page I have the different race (can be 7 or 15)I have empty rows between the races. If you do a code a need to go through every sheet in the workbook.
I have tried few thing but my code always come back like it's done nothing and my formula work if I give a range but I can not change all the time (daily file).
 

Attachments

  • 2024-06-11 14_51_44-20240608 Gap Test - Excel.png
    2024-06-11 14_51_44-20240608 Gap Test - Excel.png
    60.8 KB · Views: 25

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Your photograph is missing row numbers. Assuming that your data starts on row 7, plug this into column Y:

Excel Formula:
=LARGE(W7:W13, 1)-LARGE(W7:W13, 2)

That's for the top section. Adjust the range as necessary for the bottom section.
 
Upvote 0
On further thought, that might not be the correct solution. You have 2 sections shown in that picture:
1) Amelia Park Plate
2) Bisley Workwear

Are you saying you want to find the highest number from each of the 2 respective sections I've listed and find the difference? Or are you saying you want to find the highest 2 numbers within each section and find the difference?

Some clarification from you would be nice.

=============================

EDIT: Nevermind. Use the 1st formula above if the case is the latter. On the other hand, if you mean the former use this instead:

Excel Formula:
=ABS(LARGE(W7:W13, 1)-LARGE(W22:W28, 1))

Note:
Please also make sure to include the row numbers in your original posting to make it easier for people to come up with a solution for you. I have no idea actual rows your data starts in so I had to take a best guess. Adjust the range in the formulas if necessary.
 
Last edited:
Upvote 0
Sorry for the rows. I need a formula without any specific range because i can have a lot of sections and i do not want to change all the time the formulas.
 
Upvote 0
Could you please post some example data as text instead of image, along with the expected results?
Please use the XL2BB tool to post your example or at least just copy your data and paste it here.
 
Upvote 0
Sorry for the rows. I need a formula without any specific range because i can have a lot of sections and i do not want to change all the time the formulas.

You don't want to deal with specific ranges?? o_O :rolleyes:

The only solution would be to create named ranges for those sections like you have shown in your photo. (Or maybe a VBA solution instead).

Either way, you still have not answered my question above.
 
Upvote 0
I can`t I am trying for few times before even sending my question
Just copy your data (along with the expected result) and paste it here.
Something like this:


NameNo
Jack
2​
 
Upvote 0
DODPoints TotalNo of 3'sHigh Pts GapPrevious Form PointsClass
1​
AMELIA PARK PLATE [80,000]
Type : 2 OPEN
11:591000m, TURF S(7)
TabForm L3WgtHorseBPJockeyTrainer
13x158.0WEST STAR5CHRIS PARNHAMS MILLER-8351133
245x58.0BRAZEN BID1B PARNHAMS MILLER017301
30x56.0SOUTHERN SCANDAL2W PIKEDANIEL & BEN PEARCE015401
4856.0COONDLE4J WHITINGLOU LUCIANI
5-56.0CAPORETTO6LUKE CAMPBELL (a2)N PARNHAM08301
6-56.0SALSA SMASH4J BROWNJ TAYLOR09201
7-54.0FAVOURITE SONGS3JADE MC NAUGHTLUKE FERNIE06201
2​
BISLEY WORKWEAR HANDICAP [80,000]
Type : 2U BM78+
12:341000m, TURF S(7)
TabForm L3WgtHorseBPJockeyTrainer
184659.0BEADS1P HARVEYS WOLFE422511
241x58.0YONGA LASS7W PIKEG & A WILLIAMS019301
39x157.0CASH AWAY6HOLLY WATSONMISTY BAZELEY2.526732
417x57.0RUSSIAN TO THE BAR5CHRIS PARNHAMLUKE FERNIE020401
590x56.0EEYORE WAYZ4P CARBERYRAQUEL REID018501
6x3255.0GODDESS OF GIVING2J WHITINGLOU LUCIANI1.529621
769x55.0TOP OF THE POPS3B PARNHAMC & M GANGEMI021401
3​
NATIONAL PUMP AND ENERGY HANDICAP [60,000]
Type : 2U 1MW
13:091000m, TURF S(7)
TabForm L3WgtHorseBPJockeyTrainer
125x60.0BAYEZID2MADI DERRICK (a1.5)T ROBERTSON025601
242159.0CAPRE OMNIA5S PARNHAMDYLAN BAIRSTOW1.524531
351x58.5BERBERE4W PIKEG & A WILLIAMS028801
467x57.5OUR ROCKY BAY3B LOUIST MARTINOVICH013301
517857.0BARNEY'S WORLD8CHRIS PARNHAMLUKE FERNIE-0.526612
6x5856.5LITTLE STRAWBERRY6HOLLY WATSONMITCHELL PATEMAN319411
765x56.5MISS DRAKOVA7B PARNHAMN PARNHAM020401
80x656.5ON THE FULL1LAQDAR RAMOLYJ TAYLOR524611

I need the result to be in the column Y (High Pts Gap)
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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