Maximum value

Hatye

Board Regular
Joined
Jan 11, 2010
Messages
143
Hi,

In column A I've got dates and in column B I've got different text strings.
I would like to find the most recent text string (maximum value in A with corresponding value in B). This to be inserted into a comment, such as this:

Code:
SisteRev =


Range("J10").ClearComments
Range("J10").AddComment
Range("J10").Comment.Text Text:="Siste rev.:" & Chr(10) & SisteRev

Where "SisteRev" should be the most recent text string. Can anyone help me with this? :)
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Try eg:

Code:
SisteRev = Evaluate("=INDEX(B1:B10,MATCH(MAX(A1:A10),A1:A10,FALSE))")

Hi Andrew Poulsom and thank you for the reply!
I'm using the Norwegian version of Excel, and I have found the Norwegian formula values of 'index', 'match' and 'max'. But is 'Evaluate' a formula (which should be translated) or is it a code (which should work as written)?
When I translate the formula (without 'Evaluate') and insert it into a random excel cell, it returns correct text string. But when I use =INDEX(B1:B10,MATCH(MAX(A1:A10),A1:A10,FALSE) in the comment box, it shows the formula as written.

I hope you understand what I mean, and that you can help me with this :)
 
Upvote 0
Hmm, that's strange.. This is what I've got:
SisteRev = Evaluate("=INDEKS(Versjon!C2:C999;SAMMENLIGNE(STØRST(Versjon!A2:A999);Versjon!A2:A999);USANN)")

Where:
INDEKS = INDEX
SAMMENLIGNE = MATCH
STØRST = MAX
USANN = FALSE

Values are placed in the sheet 'Versjon' and the text string are in column C instead of B.

When I try to run a macro with 'Evaluate([...])' I've got 'Run-time error '13': Type mismatch'. Even though I get correct value when I insert the formula into a random cell.
 
Upvote 0
Have you tried using English function names? And VBA expects commas rather than semicolons as the argument separator.
 
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,844
Members
449,411
Latest member
adunn_23

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