[Solved] Find largest conditional value

Discuss the spreadsheet application
Post Reply
Alexie
Posts: 2
Joined: Sat Jan 12, 2019 5:51 pm

[Solved] Find largest conditional value

Post by Alexie »

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?
Thanks in advance
Last edited by Alexie on Sat Jan 12, 2019 7:49 pm, edited 1 time in total.
OpenOffice 4.1.1 on Windows 10
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Find largest conditional value

Post by FJCC »

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
(8.83 KiB) Downloaded 91 times
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Find largest conditional value

Post by FJCC »

You can also use an array formula. Enter the formula

Code: Select all

=MAX(IF(A2:A10 = "a";B2:B10;""))
but finish by pressing CTRL+Shift+Enter. The formula will then be enclosed in curly braces {}.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Find largest conditional value

Post by Zizi64 »

Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
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.
Alexie
Posts: 2
Joined: Sat Jan 12, 2019 5:51 pm

Re: Find largest conditional value

Post by Alexie »

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