Find max value, including more than one match, if any

valmir

Board Regular
Joined
Feb 10, 2021
Messages
235
Office Version
  1. 365
Platform
  1. Windows
Hello everyone
I'm using the formula =MAX(range) to find the maximum value from a range. However, as you know, this formula only returns the first maximum value and in case there is more than one maximum value, it will return the first value it finds.
In addition to that, I want that single or multiple maximum values to reference to adjacent cell(s) on the left.
Thanks
 
Ok how about
VBA Code:
Function valmir(MaxRng As Range, TxtRng As Range) As String
   Dim i As Long
   Dim Mx As Double
   
   Mx = Application.Max(MaxRng)
   For i = 1 To MaxRng.Rows.Count
      If MaxRng(i).Value = Mx Then valmir = valmir & ", " & TxtRng(i)
   Next i
   valmir = Mid(valmir, 3)
End Function
used like
+Fluff 1.xlsm
ABCDE
1
2Jamie6silly, that, good
3is7
4a8
5silly9
6goose8
7that9
8eats6
9good9
10food4
Import
Cell Formulas
RangeFormula
E2E2=valmir(C2:C10,A2:A10)
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
MrExcelPlayground.xlsx
BCDE
2Jamie6silly, that, good
3is7
4a8
5silly9
6goose8
7that9
8eats6
9good9
10food4
Sheet15
Cell Formulas
RangeFormula
E2E2=TEXTJOIN(", ",TRUE, IF(C2:C10=MAX(C2:C10),B2:B10,""))
Hi! I'm now using excel 2016 but when I try to use your formula, I'm getting this message:
 

Attachments

  • formula excel message.jpg
    formula excel message.jpg
    60.4 KB · Views: 7
Upvote 0
The 2016 version of Excel does not have the textjoin function.
 
Upvote 0
MrExcelPlayground.xlsx
BCDE
2Jamie6silly, that, good
3is7
4a8
5silly9
6goose8
7that9
8eats6
9good9
10food4
Sheet15
Cell Formulas
RangeFormula
E2E2=TEXTJOIN(", ",TRUE, IF(C2:C10=MAX(C2:C10),B2:B10,""))
Hi James. I upgraded to Excel 365 and your formula worked to perfection. Now I would like some help in another variant of that formula. The difference is that I want to have the top five maximum values across 16 columns, while returning all matching values, if any, of each of the top five. I also want the values to reference to the respective adjacent cells on the left.
 
Upvote 0
Hi James. I upgraded to Excel 365 and your formula worked to perfection. Now I would like some help in another variant of that formula. The difference is that I want to have the top five maximum values across 16 columns, while returning all matching values, if any, of each of the top five. I also want the values to reference to the respective adjacent cells on the left.
You might post this as another question. Few might look at a solved question. Some things that would be important... seeing your spreadsheet layout, would it be the top five in the total data set or the top five of the max of each of the 16 columns?
 
Upvote 0
You might post this as another question. Few might look at a solved question. Some things that would be important... seeing your spreadsheet layout, would it be the top five in the total data set or the top five of the max of each of the 16 columns?
Hi James. Thanks for your reply, actually I had to resort to an online paid service and I was able to get the solution from them. Thanks again!
 
Upvote 0

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

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