[Solved] Show adjacent cell value based on MIN/MAX in column

Discuss the spreadsheet application
Post Reply
jmsld_
Posts: 4
Joined: Sun Jul 05, 2020 2:24 pm

[Solved] Show adjacent cell value based on MIN/MAX in column

Post by jmsld_ »

Hello
I'm trying to display an adjacent cell content based on the min or max value in a column.
I have 2 columns with road names (A1:15) and their length (B1:B15). I want to find the minimum/maximum road length in column B, and then return the road name (column A) in another cell.
I've tried "vlookup" and "cell address" formulae, but it's not working for me. Any suggestions?

Code: Select all

=VLOOKUP(MAX(B1:B15), A1:B15, 2, 0)
- What am I doing wrong? See attachment for details.

Thank you.
 Edit: Solved. Can't seem to edit the subject line... 
Attachments
TEST.ods
(13.06 KiB) Downloaded 104 times
Last edited by MrProgrammer on Tue May 25, 2021 3:54 pm, edited 2 times in total.
Reason: Tagged ✓ [Solved]
OpenOffice 4.1.7 // Windows 10 PC
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Display adjacent cell contents based on min/max in a col

Post by Zizi64 »

TEST_Zizi64.ods
(18.28 KiB) Downloaded 106 times
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.
User avatar
MrProgrammer
Moderator
Posts: 4906
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Display adjacent cell contents based on min/max in a col

Post by MrProgrammer »

Thank you for the attachment.
jmsld_ wrote:I'm trying to display an adjacent cell content based on the min or max value in a column.
All of your formulas in the attachment fail with Err:508 in OpenOffice because you have used comma as an operand separator instead of semicolon. After fixing those problems:
• A18 returns $B$11, the address of the cell with longest road length
• A19 fails with Err:502 because you ask for column 2, but specify only one column, B1:B15, in the second operand
• A20 fails with #N/A because you search for the longest distance, a number, in the list of roads, which are text.

Consider that the designation "longest road" might not be unique. Suppose the lengths are: 5, 1, 2, 5, 3, 5.
• To find the name of the first road with the longest length, you want =INDEX(A1:A15;MATCH(MAX(B1:B15);B1:B15;0)).
• If you want a list of all the roads which are that length see [Tutorial] Sorting and Filtering data with formulas.

[Tutorial] VLOOKUP questions and answers, Q9/A9 and Q24/A24
[Tutorial] Ten concepts that every Calc user should know

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
jmsld_
Posts: 4
Joined: Sun Jul 05, 2020 2:24 pm

Re: Display adjacent cell contents based on min/max in a col

Post by jmsld_ »

Thank you! Solved. Can't edit the subject though...?
OpenOffice 4.1.7 // Windows 10 PC
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Display adjacent cell contents based on min/max in a col

Post by RoryOF »

jmsld_ wrote:Thank you! Solved. Can't edit the subject though...?
The reason is your subject line is too long - no room to enter [Solved]; the usual cure is to edit the Subject line to shorten it.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Post Reply