SOLVED
Home

Auto select drop down menu item based on a cell value

%3CLINGO-SUB%20id%3D%22lingo-sub-709057%22%20slang%3D%22en-US%22%3EAuto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-709057%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20populate%20or%20auto-select%20a%20drop-down%20menu%20item%20in%20one%20cell%20based%20on%20another%20cell's%20value%3F%3C%2FP%3E%3CP%3Eeg.%20The%20difference%20between%20two%20other%20cells%20is%20a%20positive%20value%2C%20so%20I%20would%20like%20the%20drop%20down%20menu%20in%20another%20cell%20to%20select%20one%20value%2C%20or%20a%20different%20one%20if%20the%20difference%20is%20a%20negative%20value%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-709057%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-709458%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-709458%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F363380%22%20target%3D%22_blank%22%3E%40rmmwilg%3C%2FA%3EYou%20may%20use%20IF%20function%20instead%20of%20the%20drop%20down%2C%20similar%20as%20the%20following%3A%3C%2FP%3E%3CP%3E%3DIF(A2%26gt%3B0%2CValue%201%2CValue2)%3C%2FP%3E%3CP%3EAs%20A2%20is%20the%20cell%20of%20the%20positive%20or%20negative%20value%2C%20and%20the%20formula%20is%20written%20instead%20of%20the%20drop%20down%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-709504%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-709504%22%20slang%3D%22en-US%22%3EIf%20you%E2%80%99re%20referring%20to%20alternative%20lists%2C%20you%20may%20enter%20a%20formula%20similar%20to%20this%20in%20the%20source%20box%3A%3CBR%20%2F%3E%3DIF(A2%26gt%3B0%2C%3CBR%20%2F%3EList1%2C%3CBR%20%2F%3EList2)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-712634%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-712634%22%20slang%3D%22en-US%22%3EHi%20Ayman%2C%20the%20challenge%20is%20that%20I%20have%20to%20retain%20the%20drop%20down%20menu%2C%20since%20it%20has%20other%20uses%20in%20addition%20to%20this%20'autofill'%20request.%20What%20I'm%20hoping%20for%20is%20that%20there's%20an%20ability%20to%20make%20a%20drop-down%20menu%20auto%20select%20a%20certain%20item%20based%20on%20another%20cell's%20value%20(positive%20or%20negative)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-712637%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-712637%22%20slang%3D%22en-US%22%3ENot%20sure%20if%20I%20follow%20you%20Twifoo.%20What%20I%20have%20is%20a%20drop-down%20menu%20in%20one%20cell%2C%20that%20is%20necessary%20so%20that%20the%20user%20can%20make%20other%20selections%2C%20but%20within%20the%20selections%20available%20in%20that%20drop-down%20menu%2C%20under%20certain%20conditions%2C%20it%20would%20make%20things%20a%20lot%20more%20user%20friendly%2C%20if%20the%20drop-down%20menu%20would%20auto-select%20two%20of%20its%20items%20if%20the%20value%20of%20another%20cell%20were%20positive%20or%20negative.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-712673%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-712673%22%20slang%3D%22en-US%22%3ECan%20you%20please%20attach%20a%20sample%20file%20to%20illustrate%20what%20you%20want%20to%20achieve%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-714619%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-714619%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20there%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%2C%20see%20attached.%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20the%20amount%20in%20column%20H%20(CNTRCTL)%20is%20positive%2C%20I%20would%20like%20the%20drop-down%20menu%20in%20that%20same%20row%2C%20adjacent%20cell%20to%20auto%20select%20as%20'PD%20PROJ'%2C%20when%20negative%2C%20as%20'CR%20BIDLN'.%20This%20is%20a%20payroll%20help%20sheet%20for%20pilots.%20The%20totals%20in%20column%20H%20are%20derived%20from%20the%20difference%20(if%20there%20is%20one)%20between%20the%20associated%2C%20row%20amounts%20in%20columns%20F%20%26amp%3B%20G.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715088%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715088%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F363380%22%20target%3D%22_blank%22%3E%40rmmwilg%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20attached%20file%2C%20the%20formula%20in%20the%20source%20box%20of%20the%20drop-down%20list%20in%20I9%20is%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DIF(((H9%3D%22%22)%2B(H9%3D0))*(I9%3D%22%22)%2CCodes%2CIF((H9%26gt%3B0)*(I9%3D%22%22)%2CPosCode%2CIF((H9%26lt%3B0)*(I9%3D%22%22)%2CNegCode%2C%22%22)))%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3ENote%20the%20following%20defined%20names%20therein%3A%26nbsp%3B%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3EName%3C%2FTD%3E%3CTD%3EFormula%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3ECodes%3C%2FTD%3E%3CTD%3E%3DSheet1!%24A%242%3A%24A%2414%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3ENegCode%3C%2FTD%3E%3CTD%3E%3DSheet1!%24A%244%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EPosCode%3C%2FTD%3E%3CTD%3E%3DSheet1!%24A%249%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715357%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715357%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20the%20work%20on%20this%3B%20however%2C%20I%20can't%20get%20it%20to%26nbsp%3Bwork.%20I%20also%20noticed%20that%20the%20drop-down%20menu%20seems%20to%20now%20be%20locked%3B%20ie.%20once%20a%20selection%20is%20made%2C%20it%20can't%20be%20changed.%20Great%20tip%20though%20on%20keeping%20all%20the%20entries%20on%20a%20separate%20sheet!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715390%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715390%22%20slang%3D%22en-US%22%3EWhat%20do%20you%20mean%20by%20%E2%80%9Ccan%E2%80%99t%20get%20it%20to%20work%E2%80%9D%3F%20Is%20the%20drop-down%20list%20not%20returning%20the%20results%20you%20expected%3F%20I%20deliberately%20precluded%20selecting%20another%20item%20when%20one%20has%20already%20been%20selected.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715401%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715401%22%20slang%3D%22en-US%22%3E%3CP%3EGood%20Morning%20Twifoo%2C%3C%2FP%3E%3CP%3EYes%2C%20when%20I%20put%20values%20in%20F9%20and%20G9%20to%20create%20a%20summation%20in%20H9%2C%20the%20drop-down%20menu%20in%20H9%20remains%20blank.%20That%20made%20me%20notice%20though%2C%20that%20we%20should%20expand%20the%20criterion%20for%20this%20event%20to%20only%20happen%20when%20there%20are%20values%20entered%20in%20the%20'SH'%20and%20'RA'%20columns%20(F9%20%26amp%3B%20G9%20respectively)%2C%20so%20that%20users%20can%20still%20manually%20enter%20other%20values%2C%20manually%20in%20the%20CNTRCTL%20column%20(H9)%20for%20other%20drop-down%20values%20that%20they%20would%20then%20select%20manually.%3C%2FP%3E%3CP%3EJust%20so%20I%20can%20learn%20more%2C%20could%20you%20also%20go%20through%20what%20the%20various%20coding%20stages%20you%20loaded%20mean%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715402%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715402%22%20slang%3D%22en-US%22%3EAlso%2C%20presumably%2C%20the%20coding%20would%20prevent%20a%20different%2C%20manual%20drop-down%20menu%20selection%20as%20long%20as%20there%20are%20values%20in%20F9%20and%20G(%20cells%20forcing%20it%20to%20make%20thees%20pre-determined%20selections%3F%20That%20would%20be%20fine%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715421%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715421%22%20slang%3D%22en-US%22%3EI%20suggest%20you%20fill%20in%20all%20possible%20data%20and%20their%20corresponding%20results%20from%20the%20drop-down%20list.%20Thereafter%2C%20attach%20your%20sample%20file%20again.%3CBR%20%2F%3EPlease%20note%20that%20any%20change%20you%20make%20in%20the%20conditions%20for%20the%20drop-down%20list%20shall%20trigger%20a%20corresponding%20change%20in%20the%20formula%20in%20the%20source%20box.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715436%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715436%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20again%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20working%20off%20of%20what%20you%20suggested%20I%20came%20up%20with%3A%3C%2FP%3E%3CP%3E%3DIF((SUM(F9%3AG9)%3D0)%2CCodes%2CIF((SUM(F9-G9)%26gt%3B0)%2CPosCode%2CIF((SUM(F9-G9)%26lt%3B0)%2CNegCode%2C)))%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20didn't%20realise%20that%20one%20still%20has%20to%20actually%20select%20the%20item%20from%20the%20Drop-down%2C%20so%20that's%20why%20I%20thought%20it%20%22wasn't%20working%22%2C%20because%20the%20drop-down%20menu%20cell%20was%20still%20blank.%20The%20above%20allows%20the%20user%20free%20use%20of%20the%20drop%20down%20unless%20numbers%20are%20entered%20in%20the%20associated%20F%20or%20G%20column-cells%2C%20in%20which%20case%20it%20restricts%20the%20drop-down%20selection%20accordingly.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreat%20stuff!%20Thank%20you%20very%20much!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715519%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715519%22%20slang%3D%22en-US%22%3EYou%E2%80%99re%20very%20much%20welcome!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-715759%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20select%20drop%20down%20menu%20item%20based%20on%20a%20cell%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-715759%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F363380%22%20target%3D%22_blank%22%3E%40rmmwilg%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHello%20Everyone%3C%2FP%3E%3CP%3EI%20am%20privileged%20to%20join%20this%20amazing%20community%20of%20Excel%20users%20today%20only.%3C%2FP%3E%3CP%3Ehere%20is%20a%20tutorial%20I%20created%20sometime%20ago%20on%20dependent%20drop%20lists%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D0MuQfUJbycQ%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D0MuQfUJbycQ%3C%2FA%3E%3C%2FP%3E%3CP%3EHope%20this%20helps%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3ENabil%20Mourad%3C%2FP%3E%3C%2FLINGO-BODY%3E
rmmwilg
Occasional Contributor

Hi all,

 

Is there a way to populate or auto-select a drop-down menu item in one cell based on another cell's value?

eg. The difference between two other cells is a positive value, so I would like the drop down menu in another cell to select one value, or a different one if the difference is a negative value

15 Replies

@rmmwilgYou may use IF function instead of the drop down, similar as the following:

=IF(A2>0,Value 1,Value2)

As A2 is the cell of the positive or negative value, and the formula is written instead of the drop down

If you’re referring to alternative lists, you may enter a formula similar to this in the source box:
=IF(A2>0,
List1,
List2)
Hi Ayman, the challenge is that I have to retain the drop down menu, since it has other uses in addition to this 'autofill' request. What I'm hoping for is that there's an ability to make a drop-down menu auto select a certain item based on another cell's value (positive or negative)
Not sure if I follow you Twifoo. What I have is a drop-down menu in one cell, that is necessary so that the user can make other selections, but within the selections available in that drop-down menu, under certain conditions, it would make things a lot more user friendly, if the drop-down menu would auto-select two of its items if the value of another cell were positive or negative.
Can you please attach a sample file to illustrate what you want to achieve?

@Twifoo 

 

Hi there,

 

Yes, see attached. 

When the amount in column H (CNTRCTL) is positive, I would like the drop-down menu in that same row, adjacent cell to auto select as 'PD PROJ', when negative, as 'CR BIDLN'. This is a payroll help sheet for pilots. The totals in column H are derived from the difference (if there is one) between the associated, row amounts in columns F & G.

Solution

@rmmwilg 

In the attached file, the formula in the source box of the drop-down list in I9 is: 

=IF(((H9="")+(H9=0))*(I9=""),Codes,IF((H9>0)*(I9=""),PosCode,IF((H9<0)*(I9=""),NegCode,"")))

Note the following defined names therein: 

NameFormula
Codes=Sheet1!$A$2:$A$14
NegCode=Sheet1!$A$4
PosCode=Sheet1!$A$9

@Twifoo 

 

Thanks for the work on this; however, I can't get it to work. I also noticed that the drop-down menu seems to now be locked; ie. once a selection is made, it can't be changed. Great tip though on keeping all the entries on a separate sheet!

What do you mean by “can’t get it to work”? Is the drop-down list not returning the results you expected? I deliberately precluded selecting another item when one has already been selected.

Good Morning Twifoo,

Yes, when I put values in F9 and G9 to create a summation in H9, the drop-down menu in H9 remains blank. That made me notice though, that we should expand the criterion for this event to only happen when there are values entered in the 'SH' and 'RA' columns (F9 & G9 respectively), so that users can still manually enter other values, manually in the CNTRCTL column (H9) for other drop-down values that they would then select manually.

Just so I can learn more, could you also go through what the various coding stages you loaded mean?

Also, presumably, the coding would prevent a different, manual drop-down menu selection as long as there are values in F9 and G( cells forcing it to make thees pre-determined selections? That would be fine
I suggest you fill in all possible data and their corresponding results from the drop-down list. Thereafter, attach your sample file again.
Please note that any change you make in the conditions for the drop-down list shall trigger a corresponding change in the formula in the source box.

@Twifoo 

 

Hi again,

 

So working off of what you suggested I came up with:

=IF((SUM(F9:G9)=0),Codes,IF((SUM(F9-G9)>0),PosCode,IF((SUM(F9-G9)<0),NegCode,)))

 

I didn't realise that one still has to actually select the item from the Drop-down, so that's why I thought it "wasn't working", because the drop-down menu cell was still blank. The above allows the user free use of the drop down unless numbers are entered in the associated F or G column-cells, in which case it restricts the drop-down selection accordingly.

 

Great stuff! Thank you very much!

You’re very much welcome!

@rmmwilg 

Hello Everyone

I am privileged to join this amazing community of Excel users today only.

here is a tutorial I created sometime ago on dependent drop lists:

https://www.youtube.com/watch?v=0MuQfUJbycQ

Hope this helps

Thanks

Nabil Mourad

Creating dependent drop lists. Using drop lists in Excel creates a dynamic professional worksheet. In a previous tutorial I explained how to create a drop list "Data Validation". In this tutorial we'll go one step farther by creating 2 drop lists where the contents of the second drop list change ...
Related Conversations