VLookup returns the result from the row above

DEEJ3028

New Member
Joined
Feb 6, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi, this is my first post, so take it easy on me.
I have a VLookup formula which is standard with the table array on one sheet and the lookup data in another sheet.
The formula insists on returning the value from the row above the correct result, I hope this makes sense.
So 2 sheets, first sheet is CourseList where the table information is contained in B$2:G$5828 where the lookup column is B and the result is in G
2nd Sheet is where I have the Vlookup function where column A contains the lookup value.
My formulae is =VLOOKUP(A2,CourseList!B$2:G$5830,6,1)
The correct data is in G2910 but the lookup returns data from G2909. There is not a close match to the lookup value other than the correct data in G2910.
Any help would be appreciated
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try changing the last value in the formula from 1 to 0. 0 = exact match lookup, while 1 is not.
 
Upvote 0
Welcome to the MrExcel board!

It really would help if we could see at least a small section of CourseList columns B:G so that we can see whether the data is numeric or not, whether it is sorted or not etc.
Such a sample with XL2BB would be great and you can hide columns C:F before creating the Mini Sheet.
You would also need to disguise any sensitive data in columns B & G.
Then also tell us a relevant lookup value and what result you expect from that lookup value.
 
Upvote 0
I have downloaded the addin and installed it. This is the result of the 2 sheets involved

Example of VLookup.xlsx
ABCDEFGHIJKLMNOPQ
1CourseNameTagsCourse Start DateStartDateLearning ActivitiesCourse CompletedCertificateDate of certificateCompletionDateScore of certificateVideo watchedTotal video durationTime spent in courseAverage Course ScoreVendor
2In-Depth Knowledge of Analgecf_workingrole_ambulance2022-10-24 11:35:26448582 / 22022-10-24 18:01:454485800:00:0000:00:0000:40:37Royal College of Radiologists
3In-Depth Knowledge of Analgecf_workingrole_ambulance2022-11-23 10:24:18448882 / 22022-11-23 10:27:374488800:00:0000:00:0000:03:11Royal College of Radiologists
4In-Depth Knowledge of Analgecf_workingrole_ambulance2022-11-21 11:42:36448862 / 22022-11-21 11:47:444488600:00:0000:00:0000:04:36Royal College of Radiologists
5In-Depth Knowledge of Analgecf_workingrole_ambulance2022-11-24 13:08:42448892 / 22022-11-24 13:11:034488900:00:0000:00:0000:02:03Royal College of Radiologists
6In-Depth Knowledge of Analgecf_workingrole_ambulance2022-10-24 12:20:42448580 / 2#VALUE!00:00:0000:00:0000:00:00Royal College of Radiologists
7In-Depth Knowledge of Analgecf_workingrole_ambulance2022-10-24 12:39:35448582 / 22022-10-28 14:13:154486200:00:0000:00:0000:00:26Royal College of Radiologists
8In-Depth Knowledge of Analgecf_workingrole_ambulance2022-11-24 16:05:43448892 / 22022-11-24 16:07:594488900:00:0000:00:0000:02:07Royal College of Radiologists
In-Depth Knowledge of Analge
Cell Formulas
RangeFormula
F2:F8,K2:K8F2=DATEVALUE(MID(E2,9,2)&"/"&MID(E2,6,2)&"/"&LEFT(E2,4))
Q2:Q8Q2=VLOOKUP($A2,CourseList!B$2:G$23,6,1)


and
Example of VLookup.xlsx
ABCDEFG
1CourseNameNameCategoryTypeStartDateExternal IdVendor
2e8e7040a-1df1-44e2-82c5-ae1e889dfb69Preformed Dental ImplantsDentistryOnline CourseActiveHEE_DEN_08_056Faculty of Dental Surgery Royal College of Surgeons England
3c096dc37-3e31-4700-af9c-7451c3e959c7Impression Taking and ContraindicationsAudiologyOnline CourseActiveHEE_AUD_1_07_06NHS Health Education England
4952da2f0-7ae1-4afc-8197-457d3209d3cfImpression TechniquesDentistryOnline CourseActiveHEE_DEN_09_023Faculty of Dental Surgery Royal College of Surgeons England
5f3fa4f29-730f-4432-890d-5e65c00e3ec0Improving Services: Critically EvaluatingOphthalmologyOnline CourseActiveHEE_LDF_04_02Royal College of Ophthalmologists
69932cb8d-6286-426c-8efa-8d5045328bfaImproving Services: Encouraging Improvement and InnovationOphthalmologyOnline CourseActiveHEE_LDF_04_03Royal College of Ophthalmologists
7b2c5f1db-e829-4f5f-8694-e4cb59e5e41bImproving Services: Ensuring Patient SafetyOphthalmologyOnline CourseActiveHEE_LDF_04_01Royal College of Ophthalmologists
8bafd5651-39c2-4ac4-90b1-6c784ab4587dImproving Services: Facilitating TransformationOphthalmologyOnline CourseActiveHEE_LDF_04_04Royal College of Ophthalmologists
9860ab130-f13e-4fcc-814a-b64ee4635ef3Improving the Quality and Safety of Care through Health InformaticsOphthalmologyOnline CourseActiveHEE_INF_01_04NHS Health Education England
100f2a0380-1c38-4c43-928f-dc3b55d2c2f4IMRT Reporting and PrescribingAdvanced RadiotherapyOnline CourseActiveHEE_ART_02_009Royal College of Radiologists
11086fc622-e2c4-40ad-b686-9d9281869300Inactivated Flu VaccinesImmunisation - FLUOnline CourseActiveHEE_FLU_02_001NHS Health Education England
12d07a8b0f-379f-4872-a838-a47280d70cf8Inactivated Flu Vaccines - Self-assessmentImmunisation - FLUOnline CourseActiveHEE_FLU_02_002NHS Health Education England
13055a4282-33d0-4c43-9431-62e99db4f188Incision and Closure of Skin and Subcutaneous TissueSurgeryOnline CourseActiveHEE_SUR_03_002Royal College of Surgeons
147786ca50-d69c-4504-835f-b02338a77c91Increased Density or Thickening of the Skull Vault or BaseRadiologyOnline CourseActiveHEE_RITI_05_091Royal College of Radiologists
15c65ce8fa-fe5e-4f3f-aab3-58d10215c042In-Depth Knowledge of AnalgesicsEmergency CareOnline CourseActiveHEE_PRM_05_003College of Paramedics
167889c1ce-e5d0-49ab-8afa-720b348d5be2Index of Orthodontic Treatment NeedDentistryOnline CourseActiveHEE_DEN_07_025Faculty of Dental Surgery Royal College of Surgeons England
176dfd0431-af2f-46ff-be42-0ef1ddef3d6bIndication for Postoperative Critical CareAnaesthesiaOnline CourseActiveHEE_ANA18_03_046Royal College of Anaesthetists
18c222d649-74b6-409b-9a97-407e95688fe1Indications and Contraindications for Space MaintenanceDentistryOnline CourseActiveHEE_DEN_07_010Faculty of Dental Surgery Royal College of Surgeons England
19a973a118-ab8b-4a88-ba3a-372970d3a6beIndications and Contraindications for/to Peripheral Nerve Blocks (PNBs)AnaesthesiaOnline CourseActiveHEE_ANA_05b_013Royal College of Anaesthetists
206a841ac3-f63e-4d74-ba2a-134f31b6c248Indications and Evidence for Proton Beam TherapyAdvanced RadiotherapyOnline CourseActiveHEE_ART_06_002Royal College of Radiologists
2112cd52a8-f7a3-4d6e-8417-6ae470f30b05Indications for Central Venous CannulationAnaesthesiaOnline CourseActiveHEE_ANA_03_014Royal College of Anaesthetists
2214234fff-bcc7-4d12-b421-177a4d989f63Indications For Postoperative AdmissionAnaesthesiaOnline CourseActiveHEE_ANA_03_046Royal College of Anaesthetists
235633af99-ecf6-43bc-ac50-17e78403adfdIndications for Using Uncrossed Matched BloodSurgeryOnline CourseActiveHEE_SUR_06_007Royal College of Surgeons
CourseList
 
Upvote 0
Try changing the last value in the formula from 1 to 0. 0 = exact match lookup, while 1 is not.
Thanks for the suggestion but there will be no exact matches in the sheet.
 
Upvote 0
Thanks for the sample data. Remember next time though that you can hide irrelevant columns etc. That keeps the thread simpler to look through.

Thanks for the suggestion but there will be no exact matches in the sheet.
So, if the value being looked for cannot be found, what is the logic for deciding which row should be used?
 
Upvote 0
Thanks for the sample data. Remember next time though that you can hide irrelevant columns etc. That keeps the thread simpler to look through.


So, if the value being looked for cannot be found, what is the logic for deciding which row should be used?
That is why we are using the TRUE,1 value in the lookup. We get the information from the sheet tab name which truncates the course name. If the value is not found it will report the error. In the example provide the correct result is on row 15 and the result should be the College of Paramedics but returns the value in the row above, Royal College of Radiologists. I have confirmed it as being this value by changing the VLookup to return the value in col 5.
 
Upvote 0
It is very hard to work out a pattern from only one example but assuming all your names are truncated in your main sheet, try this:
Excel Formula:
=VLOOKUP($A2&"*",CourseList!B$2:G$23,6,0)
 
Upvote 0
We get the information from the sheet tab name which truncates the course name.
OK, I had not caught on to that. Try this instead.
Excel Formula:
=VLOOKUP($A2&"*",CourseList!B$2:G$23,6,0)

More efficient with your version though would be
Excel Formula:
=XLOOKUP(A2&"*",CourseList!B$2:B$23,CourseList!G$2:G$23,,2)
 
Upvote 1

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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
Back
Top