Complex data validation problem

teachman

Active Member
Joined
Aug 31, 2011
Messages
321
Hello and Happy New Year to y'all!

I thought I'd start my New Year off right with a data validation problem. Setting: cell K6 holds 2 char state abbreviation; cell AH12 holds elevation at a specific latitude/longitude.

Problem, I want to make sure the user doesn't enter an elevation value (AH12) that is outside the elevation range found in the state (K6). I have a lookup table with three columns, ST, Max Elev, and Min Elev. I've set the table as the named range StMaxMinElev. That's about as far as I can get. I suppose I could use a series of nested IF statements, but there must be a better way.

I would appreciate any help y'all can give me.

Thanks,


George Teachman
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Marcelo Branco

MrExcel MVP
Joined
Aug 23, 2010
Messages
16,653
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Data > Data Validation > Data Validation > Custom

Try this formula
=AND(VLOOKUP(K6,StMaxMinElev,2,0)>=AH12,VLOOKUP(K6,StMaxMinElev,3,0)<=AH12)

M.
 

teachman

Active Member
Joined
Aug 31, 2011
Messages
321
Marcelo,

Thanks for the help. That is a lot easier than trying to do it with vba scripting.

George
 

Forum statistics

Threads
1,136,354
Messages
5,675,301
Members
419,560
Latest member
g3org

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