VLOOKUP formula is not working and I can't figure out why

teresajm

New Member
Joined
Jan 21, 2020
Messages
18
Office Version
  1. 2016
Platform
  1. Windows
I'm working with two separate tables.

1. Table A lives on a tab called 'Proposed Pieces'. It contains lots of data including a column called "DURATION" containing a cell with a value in it. In this table there is also a column called "G" with grades from 0 to 8.
table-a-png.81902


2. Table B lives on a tab called 'Grade Durations'. This table describes the minimum and maximum duration corresponding to a specific grade using the columns "GRADE", "MINIMUM DURATION" and "MAXIMUM DURATION".
1672695904894.png


My VLOOKUP formula:
=OR(O2<VLOOKUP(C2, 'Grade Durations'!$A$1:$C$10, 2, TRUE), C2>VLOOKUP(O2, 'Grade Durations'!$A$1:$C$10, 3, TRUE))

I want the VLOOK formula to:
(i) check the column "Duration" in Table A, as well as the corresponding "G" column (in table A)
(ii) check the relevant row in Table B by matching the "G" value from table A with the GRADE value in Table B. Then it will sees what the relevant "Minimum Duration" and "Maximum Duration" is.
(iii) highlight the cell in column "DURATION" in Table A if the value within the cell doesn't fall within the "MINIMUM DURATION" and "MAXIMUM DURATION" values specific to the GRADE values in Table B.


Instead all of the cells are highlighted, regardless of whether they are less than or more than the related range - in this picture I've shown (with the red dot) which ones should not be highlighted:
TABLE A result.png
 

Attachments

  • Table A.png
    Table A.png
    115.2 KB · Views: 152

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
It looks like:

=OR(O2<VLOOKUP(C2, 'Grade Durations'!$A$1:$C$10, 2, TRUE), C2>VLOOKUP(O2, 'Grade Durations'!$A$1:$C$10, 3, TRUE))

should be?

=OR(O2<VLOOKUP(C2, 'Grade Durations'!$A$1:$C$10, 2, TRUE), O2>VLOOKUP(C2, 'Grade Durations'!$A$1:$C$10, 3, TRUE))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,173
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