[Solved] Find largest conditional value

[Solved] Find largest conditional value

Hi,

I have come across a problem which I cannot seem to solve on my own. I have the following situation:
ID Value
A 1.5
A 1.5
B 2.5
A 4

And I would like to select the largest value for a given value:
ID Value
A 4
B 2.5

Any suggestions to achieve this by code?
Last edited by Alexie on Sat Jan 12, 2019 7:49 pm, edited 1 time in total.
OpenOffice 4.1.1 on Windows 10
Alexie

Posts: 2
Joined: Sat Jan 12, 2019 5:51 pm

Re: Find largest conditional value

One way to do this is with a Pivot Table (menu item Data -> Pivot Table). Right click on the table in the attached document and select Edit Layout to see how I set it up. You can double click on the item that says Max Value to see other options for calculating statistical properties of the Value column.
Attachments
MaxByID.ods
Windows 10 and Linux Mint, since 2017
FJCC
Moderator

Posts: 7225
Joined: Sat Nov 08, 2008 8:08 pm

Re: Find largest conditional value

You can also use an array formula. Enter the formula
Code: Select all   Expand viewCollapse view
=MAX(IF(A2:A10 = "a";B2:B10;""))

but finish by pressing CTRL+Shift+Enter. The formula will then be enclosed in curly braces {}.
Windows 10 and Linux Mint, since 2017
FJCC
Moderator

Posts: 7225
Joined: Sat Nov 08, 2008 8:08 pm

Re: Find largest conditional value

Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.

Zizi64
Volunteer

Posts: 8142
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Find largest conditional value

I tried the suggested solution in the above thread.
It works! Many thanks for your replies!
OpenOffice 4.1.1 on Windows 10
Alexie

Posts: 2
Joined: Sat Jan 12, 2019 5:51 pm