SOLVED

Creating a default value from drop down list

%3CLINGO-SUB%20id%3D%22lingo-sub-1110365%22%20slang%3D%22en-US%22%3ECreating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1110365%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20probably%20not%20using%20the%20correct%20terms%2C%20but%20essentially%20I%20am%20trying%20to%20have%20a%20dropdown%20list%20in%20a%20cell.%20I%20know%20how%20to%20do%20this.%20I%20want%20it%20to%20display%20the%20first%20choice%20in%20the%20dropdown%20list%20until%20the%20user%20selects%20a%20different%20one.%26nbsp%3B%20Essentially%20it's%20a%20default%20response%20that%20is%20populated%20in%20the%20cell%20until%20user%20selects%20to%20change%20it%20from%20the%20dropdown.%26nbsp%3B%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1110365%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1110416%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1110416%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F519689%22%20target%3D%22_blank%22%3E%40JimS-2145%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20could%20have%20the%20validated%20cell%20point%20at%20the%20first%20cell%20in%20the%20list.%20Suppose%20your%20list%20populating%20the%20dropdown%20starts%20at%20A6%2C%20you%20could%20enter%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3D%24A%246%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E....in%20each%20cell%20that%20requires%20validation.%20Example%20attached.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1110519%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1110519%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3BThank%20you.%20Simple%20and%20effective.%20One%20more%20question%20you%20may%20know.%20How%20do%20I%20get%20this%20to%20persist%20as%20I%20add%20rows%20with%20new%20customers%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1110538%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1110538%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F519689%22%20target%3D%22_blank%22%3E%40JimS-2145%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENot%20sure%20I%20follow.%20You%20mean%20that%20you%20want%20to%20expand%20the%20range%20that%20populates%20the%20drop%20down%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1110830%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1110830%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3BI%20have%20a%20long%20list%20of%20customers.%20I%20was%20successfully%20able%20to%20add%20your%20solution%20to%20the%20existing%20rows.%20Thank%20you!%20The%20challenge%20I%20am%20having%20now%20is%20when%20I%20add%20a%20new%20row%2Fcustomer%20to%20my%20list%2C%20which%20is%20in%20table%20format.%20The%20%3D%24A%246%20doesn't%20copy%20into%20the%20cell%20when%20I%20add%20the%20new%20row.%20I%20realize%20this%20is%20an%20issue%20unrelated%20to%20the%20initial%20question%2C%20but%20something%20I%20will%20need%20to%20solve.%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1111025%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1111025%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F519689%22%20target%3D%22_blank%22%3E%40JimS-2145%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENot%20sure%20I%20follow.%20Are%20you%20inserting%20above%20A6%3F%20Then%20the%20cell%20under%20your%20drop%20down%20will%20point%20A7%2C%20despite%20the%20dollar%20signs.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1111077%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1111077%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EI%20am%20adding%20new%20rows%20at%20the%20bottom.%20Essentially%20I%20have%20a%20worksheet%20of%20customers.%20I%20have%20created%20dropdown%20lists%20for%20different%20columns%2C%20such%20as%20region%20and%20industry.%20I%20made%20this%20worksheet%20into%20a%20table%20so%20as%20I%20add%20a%20new%20row%2Fcustomer%2C%20the%20table%20design%20would%20continue%20and%20ideally%20so%20would%20the%20dropdown%20lists.%20The%20table%20design%20does%20continue%2Fexpand......however%2C%20the%20cells%20that%20should%20have%20the%20dropdown%20lists%20do%20not%2C%20and%20the%20%22%3DA%246%22%20does%20not%20either.%20They%20are%20empty%20-%20the%20dropdown%20lists%20and%20%22%3DA%246%22%20did%20not%20follow.%20The%20question%20goes%20beyond%20the%20%22%3DA%246%22.........it's%20more%20about%20properly%20converting%20my%20worksheet%20into%20a%20table%20so%20formulas%20and%20dropdown%20lists%20will%20continue%20as%20I%20add%20new%20rows%2Fcustomers%20at%20the%20bottom.%26nbsp%3B%20Thanks.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1111105%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1111105%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F519689%22%20target%3D%22_blank%22%3E%40JimS-2145%3C%2FA%3E%26nbsp%3BDifficult%20to%20resolve%20without%20the%20worksheet%20%22in-hand%22.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1111636%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1111636%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3BI%20went%20back%20and%20recreated%20all%20of%20my%20tables%20and%20validations%20and%20now%20it%20works.%20Your%20solution%20for%20creating%20a%20default%20answer%20was%20perfect%20and%20a%20lot%20easier%20than%20other%20visual%20basic%20solutions%20I've%20read.%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1111877%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1111877%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F519689%22%20target%3D%22_blank%22%3E%40JimS-2145%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou're%20welcome.%20Glad%20you%20figured%20it%20out%20yourself!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186824%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186824%22%20slang%3D%22en-US%22%3EIf%20changes%20are%20made%20in%20the%20validated%20cell%2C%20the%20formula%20will%20be%20lost.%20What%20if%20changes%20are%20made%20in%20the%20source%20list%20and%20I%20want%20that%20the%20first%20value%20from%20the%20list%20would%20still%20be%20the%20default%20value%20in%20the%20validated%20cell%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186841%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186841%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2187075%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2187075%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F987642%22%20target%3D%22_blank%22%3E%40jefort%3C%2FA%3E%26nbsp%3BYou'll%20need%20a%20small%20piece%20of%20VBA%20in%20the%20worksheet%20code%20for%20that.%20Now%2C%20I'm%20not%20a%20VBA%20expert%2C%20so%20I%20just%20picked-up%20an%20example%20from%20the%20web%20%3CA%20href%3D%22https%3A%2F%2Fwww.automateexcel.com%2Fvba%2Fworksheet-change-event%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.automateexcel.com%2Fvba%2Fworksheet-change-event%2F%3C%2FA%3E%26nbsp%3Band%20adapted%20it%20to%20your%20schedule.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20also%20added%20some%20formulae%20(in%20columns%20P%20and%20Q)%20that%20will%20work%20if%20you%20are%20on%20a%20modern%20Excel%20version%20that%20supports%20the%20use%20of%20UNIQUE%20and%20FILTER.%20Two%20functions%20that%20will%20be%20much%20easier%20to%20write%2C%20understand%20and%20maintain%20than%20what%20you%20currently%20have%20in%20column%20M.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20if%20you%20prefer%20not%20to%20download%20and%20open%20a%20macro%20enabled%20workbook%2C%20follow%20the%20instructions%20in%20the%20above-mentioned%20link%20and%20paste%20the%20following%20code%20in%20the%20code%20area%20for%20Sheet1.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3EPrivate%20Sub%20Worksheet_Change(ByVal%20Target%20As%20Range)%0A%0AIf%20Target.Address%20%3D%20%22%24G%247%22%20Then%0A%0A%20%20%20%20%20Range(%22G8%22).Formula%20%3D%20%22%3DM7%22%0A%0AEnd%20If%0A%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2187477%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2187477%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWOW.%20Thanks%20a%20LOTTTT.%20It%20worked.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20been%20searching%20the%20web%20on%20how%20to%20do%20this%20and%20here%20it%20is%20fixed%20already.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you.%20Thank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2204370%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2204370%22%20slang%3D%22en-US%22%3EWhat%20if%20I%20have%20TWO%20If-Then%20statements%20to%20run%20for%20one%20sheet.%20How%20should%20I%20do%20this.%20For%20instance%3A%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20Target.Address%20%3D%20%22%24E%2410%22%20Then%3CBR%20%2F%3ERange(%22W10%22).Formula%20%3D%20%22%3DI5%22%3CBR%20%2F%3EEnd%20If%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20Target.Address%20%3D%20%22'%24H%244%22%20Then%3CBR%20%2F%3ERange(%22AO10%22).Formula%20%3D%20%22%3DK4%22%3CBR%20%2F%3EEnd%20If%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2204416%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20a%20default%20value%20from%20drop%20down%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2204416%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F987642%22%20target%3D%22_blank%22%3E%40jefort%3C%2FA%3E%26nbsp%3BI%20guess%20that%20would%20work.%20Give%20it%20a%20try.%20As%20said%2C%20I'm%20not%20very%20much%20into%20VBA.%20Perhaps%20someone%20else%20here%20can%20step%20in.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I am probably not using the correct terms, but essentially I am trying to have a dropdown list in a cell. I know how to do this. I want it to display the first choice in the dropdown list until the user selects a different one.  Essentially it's a default response that is populated in the cell until user selects to change it from the dropdown.  Thanks.

16 Replies
best response confirmed by JimS-2145 (Occasional Contributor)
Solution

@JimS-2145 

You could have the validated cell point at the first cell in the list. Suppose your list populating the dropdown starts at A6, you could enter:

=$A$6

....in each cell that requires validation. Example attached.

@Riny_van_Eekelen Thank you. Simple and effective. One more question you may know. How do I get this to persist as I add rows with new customers?

@JimS-2145 

Not sure I follow. You mean that you want to expand the range that populates the drop down?

 

@Riny_van_Eekelen I have a long list of customers. I was successfully able to add your solution to the existing rows. Thank you! The challenge I am having now is when I add a new row/customer to my list, which is in table format. The =$A$6 doesn't copy into the cell when I add the new row. I realize this is an issue unrelated to the initial question, but something I will need to solve. Thanks.

@JimS-2145 

Not sure I follow. Are you inserting above A6? Then the cell under your drop down will point A7, despite the dollar signs.

I am adding new rows at the bottom. Essentially I have a worksheet of customers. I have created dropdown lists for different columns, such as region and industry. I made this worksheet into a table so as I add a new row/customer, the table design would continue and ideally so would the dropdown lists. The table design does continue/expand......however, the cells that should have the dropdown lists do not, and the "=A$6" does not either. They are empty - the dropdown lists and "=A$6" did not follow. The question goes beyond the "=A$6".........it's more about properly converting my worksheet into a table so formulas and dropdown lists will continue as I add new rows/customers at the bottom.  Thanks.

@JimS-2145 Difficult to resolve without the worksheet "in-hand".

@Riny_van_Eekelen I went back and recreated all of my tables and validations and now it works. Your solution for creating a default answer was perfect and a lot easier than other visual basic solutions I've read. Thanks.

@JimS-2145 

You're welcome. Glad you figured it out yourself!

If changes are made in the validated cell, the formula will be lost. What if changes are made in the source list and I want that the first value from the list would still be the default value in the validated cell?

@jefort You'll need a small piece of VBA in the worksheet code for that. Now, I'm not a VBA expert, so I just picked-up an example from the web https://www.automateexcel.com/vba/worksheet-change-event/ and adapted it to your schedule.

 

I have also added some formulae (in columns P and Q) that will work if you are on a modern Excel version that supports the use of UNIQUE and FILTER. Two functions that will be much easier to write, understand and maintain than what you currently have in column M. 

 

Now, if you prefer not to download and open a macro enabled workbook, follow the instructions in the above-mentioned link and paste the following code in the code area for Sheet1.

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$G$7" Then

     Range("G8").Formula = "=M7"

End If

End Sub

 

 

 

@Riny_van_Eekelen 

 

WOW. Thanks a LOTTTT. It worked.

 

I've been searching the web on how to do this and here it is fixed already.

 

Thank you. Thank you.

What if I have TWO If-Then statements to run for one sheet. How should I do this. For instance:

If Target.Address = "$E$10" Then
Range("W10").Formula = "=I5"
End If

If Target.Address = "'$H$4" Then
Range("AO10").Formula = "=K4"
End If

@jefort I guess that would work. Give it a try. As said, I'm not very much into VBA. Perhaps someone else here can step in.

@jefort 

Just an observation, but you have a single apostrophe included in the $H$4 string that I think will cause that test to fail:

JMB17_0-1615532692874.png