Excell HELP!! formu...
 

[Closed] Excell HELP!! formula is driving me batty

18 Posts
5 Users
0 Reactions
70 Views
Posts: 0
Free Member
Topic starter
 

[img] [/img]

So I have column C with values next to column B with the corresponding dates.

I would like a formula to find the highest value then display the corresponding date that this value is from.

Currently using:
=VLOOKUP(MAX(C2:C9), B2:C9, 10, FALSE)

Please save me from defenestrating my laptop!

 
Posted : 15/01/2016 2:40 pm
Posts: 36
Free Member
 

vlookup cant look left.
only right

 
Posted : 15/01/2016 2:46 pm
Posts: 3643
Full Member
 

=INDEX(B:B,MATCH(MAX(C:C),C:C,0),1)

Edit: If you have two dates with the same number it will only pick up the first one. Don't know if that's a problem.

And you're dumping a lot of people. Playaaaa!

 
Posted : 15/01/2016 2:50 pm
Posts: 1307
Full Member
 

Does the LARGE function help?

Actually, the offset of 10 - what's that meant to be returning? You probably want to copy the dates into another column and hide it. As it stands, you're looking for the value 23 in the range B2->B9. It doesn't exist there - hence the #N/A

Just copy the dates (or create a column with =B2 etc) into a new column between C and D (it it's the new D).

Then use VLOOKUP(max(C2:C9), C2:D9, 2, false)

Edit - or use index/match as above 🙂

 
Posted : 15/01/2016 2:51 pm
Posts: 0
Free Member
Topic starter
 

cheers! having a crack at that....

 
Posted : 15/01/2016 2:52 pm
Posts: 3643
Full Member
 

Edit: Sneaky edit by the OP 🙂

 
Posted : 15/01/2016 2:53 pm
Posts: 25735
Full Member
 

=B7

HTH

 
Posted : 15/01/2016 2:55 pm
Posts: 36
Free Member
 

Can you write me an example code that would work please?

it depends.

as above - are you able to change the layout of the sheet?

if not, then you cant use vlookup and have to use OFFSET/INDE etc or similar.

If you can change the layout, either move the date column to the right of the VALUES column and use the formula posted above, OR, add a second date column one to the right of the VALUES column and use the VLOOKUP formula on those two columns (Now C & D)

 
Posted : 15/01/2016 2:55 pm
Posts: 0
Free Member
Topic starter
 

That code returns a value (not a date)
And the value does not actually exist anywhere in the spreadsheet?

Is this because the date values need to be formatted in a specific way eg. date/text etc

 
Posted : 15/01/2016 2:59 pm
Posts: 0
Free Member
Topic starter
 

[img] [/img]

 
Posted : 15/01/2016 3:00 pm
Posts: 1307
Full Member
 

A date is just a value - you need to format the cell as a date and you'll get your date.

 
Posted : 15/01/2016 3:00 pm
Posts: 3643
Full Member
 

Format that cell as a date.

Each date is actually a number, with 01/01/1900 being 1, 02/01/1900 being 2. etc. So 41553 is 06/10/2013.

 
Posted : 15/01/2016 3:02 pm
Posts: 0
Free Member
Topic starter
 

The correct value is 3255 in cell C185 which should display the date 06/10/2013

 
Posted : 15/01/2016 3:02 pm
Posts: 1307
Full Member
 

Actually... in your match() statement, the last argument should probably be 0 not 1. Your data isn't sorted and you want an exact match (from memory, please check)

A date value is the number of days since 1900 and something.. not related to the 3255 value - not sure what that is. If you format the cell as a date (can just use the dropdown currently saying "General"), you should see the date.

 
Posted : 15/01/2016 3:04 pm
Posts: 0
Free Member
Topic starter
 

[img] [/img]

 
Posted : 15/01/2016 3:06 pm
Posts: 3643
Full Member
 

Actually... in your match() statement, the last argument should probably be 0 not 1. Your data isn't sorted and you want an exact match (from memory, please check)

The match statement ends in zero already. The 1 is for the column number of the INDEX range (B:B). It might be unnecessary because there is only one column in the range.

 
Posted : 15/01/2016 3:06 pm
Posts: 0
Free Member
Topic starter
 

Legends Thank You!!

 
Posted : 15/01/2016 3:06 pm
Posts: 1307
Full Member
 

The match statement ends in zero already. The 1 is for the column number of the INDEX range (B:B). It might be unnecessary because there is only one column in the range.

So it does.. as you were (sorry bails!)

 
Posted : 15/01/2016 3:07 pm
Posts: 3643
Full Member
 

So it does.. as you were (sorry bails!)
No worries

For anyone interested, INDEX MATCH does the same thing as a VLOOKUP, but in two seperate steps.

So if you find a match to your lookup text in the tenth row of your MATCH range, then you can return the tenth row of your INDEX (the date, in this case) range. But because each bit is built seperately you can offset the two (e.g add a +1 afetr the closing bracket of the MATCH and you'll return the row below the one that matches. Or you can specifiy A1:A10 as the MATCH range and B21:B30 as the INDEX range.

Most of the time it's just useful for a doing a straightforward VLOOKUP to a column on the right, like this.

 
Posted : 15/01/2016 3:14 pm