Vlookup with the beginning of a cell

Lauren111111

New Member
Joined
May 1, 2020
Messages
21
Office Version
  1. 2013
Platform
  1. Windows
I’m trying to vlookup the beginning of a cell and return a value from a table on another sheet.
E.g Luton = 5:30
But I want it to return the same value if it says Luton 2, or Luton 5
I can get this to work, but when I add more destinations and hours it stops working and find random values from elsewhere in the table even though another destination is completely different e.g Milton Keynes?? Is there a limit on the amount of data I can lookup with a partial cell? help please?
 

Some videos you may like

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
wrap in LEFT(,5), though vlookup will only return the first correct match
 

Lauren111111

New Member
Joined
May 1, 2020
Messages
21
Office Version
  1. 2013
Platform
  1. Windows
How would I do this?? So far I have
=vlookup(c3&”*”,Sheet2!$B$3:$C$9,2,true)
Where c3 = Luton, and the data range is the destinations and timings
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,993
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Try using
VBA Code:
=vlookup(left(c3,5),Sheet2!$B$3:$C$9,2,true)
But as @mole999 said, it will only return the first correct entry
 

Lauren111111

New Member
Joined
May 1, 2020
Messages
21
Office Version
  1. 2013
Platform
  1. Windows

ADVERTISEMENT

Thanks, have given it a try but doesn’t work as id like. Is there any other way I could get this to work?
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,993
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
you might need to post some sample data, with the result you expect.....use the XL2BB button to paste data back here
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows

ADVERTISEMENT

if the numbers are superflous then they could be substituted out
 

Lauren111111

New Member
Joined
May 1, 2020
Messages
21
Office Version
  1. 2013
Platform
  1. Windows
If anyone has the same query, we managed to fix it - the lookup data range needed to be in alphabetical order then it worked! This is why it wouldnt lookup past certain values. Thanks for advice everyone.
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
If anyone has the same query, we managed to fix it - the lookup data range needed to be in alphabetical order then it worked! This is why it wouldnt lookup past certain values. Thanks for advice everyone.
that should mean that the list selection was not long enough, and need to use 1 for inexact match and 0 for exact match. Vlookup returns the FIRST entry only from the listed values
 

Watch MrExcel Video

Forum statistics

Threads
1,126,893
Messages
5,621,480
Members
415,844
Latest member
Reda Fouad Ramzy

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
Top