Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-21-2023, 06:22 AM
Karen615 Karen615 is offline Drop-down for States Windows 7 64bit Drop-down for States Office 2010 64bit
Competent Performer
Drop-down for States
 
Join Date: Jun 2011
Location: Chicago
Posts: 112
Karen615 is on a distinguished road
Default Drop-down for States

Hello,

Is it possible to set up a drop-down for all 50 states? When the user opens the drop-down they can see (for example) New York-NY, California-CA, etc Then when a state is chosen, only the 2-character state is entered into the cell.



Your help is greatly appreciated.

Thank you,
Karen


Using Excel 365
Reply With Quote
  #2  
Old 06-21-2023, 08:32 AM
ArviLaanemets ArviLaanemets is offline Drop-down for States Windows 8 Drop-down for States Office 2016
Expert
 
Join Date: May 2017
Posts: 873
ArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud of
Default

By "drop-down" you are meaning "Data Validation List". When yes, then it isn't possible. Easiest workaround will be:
On separate sheet create a table, where 1st column lists all 50 States, and in second column are 2-character codes for those States. Define the 1st column of this table as named range. In your original table, set Data Validation List with defined Name as list source (using Names is only way to use tables in another sheets as Data Validation Source). In another column, use VLOOKUP formula to get 2-character codes from States table, depending on your selection you did using Data Validation.
Reply With Quote
  #3  
Old 07-12-2023, 11:24 AM
Karen615 Karen615 is offline Drop-down for States Windows 11 Drop-down for States Office 2021
Competent Performer
Drop-down for States
 
Join Date: Jun 2011
Location: Chicago
Posts: 112
Karen615 is on a distinguished road
Default

Thank you so much for your help. I’ve been trying to figure this out but get stumped at VLOOKUP. I have used VLOOKUP before but cannot get this to work with a drop-down. Can you shed some more light on this? Your help would be greatly appreciated.

Thank you,
Karen
Reply With Quote
  #4  
Old 07-12-2023, 01:18 PM
Logit Logit is offline Drop-down for States Windows 10 Drop-down for States Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Another method ... (see attached)

Code:
=IF(A1="Alabama - AL","AL",IF(A1="Florida - FL","FL",IF(A1="Washington - WA","WA","")))
Attached Files
File Type: xlsm States Selection and Abbreviation.xlsm (8.8 KB, 5 views)
Reply With Quote
  #5  
Old 07-12-2023, 10:24 PM
ArviLaanemets ArviLaanemets is offline Drop-down for States Windows 8 Drop-down for States Office 2016
Expert
 
Join Date: May 2017
Posts: 873
ArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud of
Default

Quote:
Originally Posted by Karen615 View Post
... I’ve been trying to figure this out but get stumped at VLOOKUP. I have used VLOOKUP before but cannot get this to work with a drop-down...
You don't use VLOOKUP in Data Validation. In Excel, you need to use 2 columns for what you want to achieve. In first you select State code, and in second the formula retrieves according State name from States table. (In second column you probably want to check for State code not being an empty string too!)

Logit:
Excel has limitation for number of nested IF's (7 when I remember properly). So for 50 States this doesn't work. There is a workaround using additional IF's to group States to smaller subgroups (for every subgroup level the number of nested IF's you can use will be reduced by 1 - so when using 2 subgroups, you can nest 2*6=12 IF's, when using 2*2 subgroups, then you can nest 4*5=20 IF's, etc.), but this formula will be very long and clumsy, and 50 will be anyway out of reach.
The another workaround is use formula like
Code:
=IF(StateCode=CodeValue1,TextValue1, "") & IF(StateCode = CodeValue2, TextValue2, "") & ...
No limitations there except the fomula length, but ...
Reply With Quote
  #6  
Old 07-16-2023, 06:36 PM
Karen615 Karen615 is offline Drop-down for States Windows 11 Drop-down for States Office 2021
Competent Performer
Drop-down for States
 
Join Date: Jun 2011
Location: Chicago
Posts: 112
Karen615 is on a distinguished road
Default

Quote:
Originally Posted by Logit View Post
Another method ... (see attached)

Code:
=IF(A1="Alabama - AL","AL",IF(A1="Florida - FL","FL",IF(A1="Washington - WA","WA","")))
Thank you so much! I'll check it out and see if I can get it to work for me.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract States from a String soldat452002 Excel 9 04-26-2018 04:16 AM
Drop down box list based on response to another drop down box Phideaux Excel 16 04-13-2018 03:07 AM
Drop-down for States Drop down lists and pulling data from worksheet based on drop down selection cjoyce73 Excel 5 07-17-2017 07:40 AM
How to import a map from mappoint 13 into PP 13 and then color fill individual states rideninc PowerPoint 0 01-22-2014 03:50 PM
Analysis of states and income levels knownunknown Excel 1 01-22-2011 06:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:03 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft