I'm changing an old Excel spreadsheet and have got a user-request to add a drop-down list to a date selection field.
Data Validation is already turned on for the cell in question with a "<=TODAY()" clause (the sheet contains information on production efficiency, no idea going forward since data is not there).
The user requests a drop-down listing the past seven days. I can make a list and enumerate it in VBA, but I am having difficulties coming up with a way to apply a drop-down list to a cell without using Validation.
Is this possible?
Here are some ways you can try:
Add a datepicker to the cell (and keep the formula validation you put)
a. See some standard way on MSDN
b. or with an addin on this blog
Change dynamicaly your validation to a dropdown list when the Workbook is opened or the worksheet activated with an event procedure and add another event procedure OnChange to check if the value entered is before today.
Why not replace the existing data validation rule with a list rule? Just create a new sheet and enter in A1:A7
=TODAY()
=A1-1
...
=A1-6
Then set your data validation rule to "List" and set the Source to A1:A7 on the new sheet. Then hide the sheet just to keep it out of the way. This should preserve the old validation requirement.
Related
I have an excel file with two sheets. The second sheet (Report) contains data validation cells based on the first sheet (Data). From the second sheet, the drop-down list that displays in the Select XXX depends on the selection in the Generate Report. When the Generate Report is set to anything beyond the first five in its list, the "Select XXX" displays year as a default list (no problem with this) via the code ...INDIRECT("Year").... The problem is that excel does not allow for addition of more code (seems I hit the limit). The question is - how can I manipulate this code to accommodate every option in the Generate Report? or perhaps, is there another method to implement?
The data validation source code for the drop-down list is =IF($B$4=Data!$Q$5,INDIRECT("Client"), IF($B$4=Data!$Q$6,INDIRECT("Month"), IF($B$4=Data!$Q$7,INDIRECT("Product_Service"), IF($B$4=Data!$Q$8,INDIRECT("Sector"), IF($B$4=Data!$Q$9,INDIRECT("Trans_Type"),INDIRECT("Year"))))))
Please, see the sample file at https://drive.google.com/file/d/1VKkGHjlJzLQqx4J9kyd_bCKG4r0Q7HkG/view?usp=sharing
What you could do is put the range names in column R, and VLOOKUP them:
=IFERROR(INDIRECT(VLOOKUP($B$4,Data!$Q$5:$R$9,2,FALSE)),INDIRECT("Year"))
You could then have as many item lists as you wish.
I have spent hours searching for an answer and attempted to create my own solution with little pieces of information I gleaned, but I am still no closer to a solution.
Scenario: I have a data table (sorted by index field that I want to use). I have a CRITERIA column and the INDEX column. I have a form worksheet where I want the list to appear. On a second form worksheet I have VBA code attached to a button(s) that filters the data table in-place. On the form sheet there is a SELECTION CRITERIA field that, based on the value selected from the pull-down 'data validation' menu, dynamically populates the form fields from the values on the corresponding row in the data table. (this is accomplished by a VBA event trigger to the cell, and population is accomplished with other VBA code. The event trigger also prompts user to write changes back to the data table if changes are identified from the previous populated form.)
PROBLEM: I want the data validation list on the SELECTION CRITERIA cell to dynamically change based upon the auto-filter triggered by the button selection. (each button runs a VBA procedure that filters the list based upon one or more criteria)
I am most grateful for any suggestions or solutions provided!
How to change Excel sheet source dynamically depending on particular values?
I am developing an Excel sheet. Depending on one dropdown value, fields of other dropdown should change dynamically.
Suppose I choose one value from dropdown1, dropdown2 should get certain column from "Sheet2" and if I choose another value from dropdown1, dropdown2 should get certain column from suppose "Sheet".
How can I achieve this?
This should be related to Excel formulas I guess.
Just follow this tutorial
Create lists
Give lists a name
Use data validation to create dropdown
Use indirect when creating new data validation
One can create a list using the data validation tool. However is it possible to do the same using only a formula (not VBA)?
If I have a named range consisting of several cells (Names), I can reference this in another cell (=Names). However only the contents of the first of these cells will appear, and no drop-down menu presenting all options will be created.
Is there a way to do so without VBA and without data validation?
Thanks
As I know it is not possible to create a drop down list with formula instead of data validation but below method may be used to achieve your goal (Method already also mentioned by #PermaNoob in the comment section.)
A page layout like this:
Data validation formula as following:
=IF($A$2="List",$C$2:$C$8,$D$2:$D$8)
And also alert option will be disabled ( to be able to add custom data):
When you write "List" in the cell "A2" you will get the Column C in the drop down list and if you do not write anything in cell "A2" you will get D column in the drop down list.
Let's say in Sheet1 I have a list of codes ("AA", "QF", etc).
In Sheet2, I want a particular column to have cells that, when you click them, have a dropdown that consists of values from the code-list on Sheet1. (so you could fill the value of the cell with AA, QF, etc).
Is this doable?
As cardern has said list will do the job.
Here is how you can use a named range.
Select your range and enter a new name:
Select your cell that you want a drop down to be in and goto data tab -> data validation.
Select 'List' from the 'Allow' Drop down menu.
Enter your named range like this:
Now you have a drop down linked to your range. If you insert new rows in your range everything will update automatically.
Yes it is. Use Data Validation from the Data panel. Select Allow: List and pick those cells on the other sheet as your source.
That cannot be done in excel 2007. The list must be in the same sheet as your data.
It might work in later versions though.
I was able to make this work by creating a named range in the current sheet that referred to the table I wanted to reference in the other sheet.
Excel has a very powerful feature providing for a dropdown select list in a cell, reflecting data from a named region. It'a a very easy configuration, once you have done it before. Two steps are to follow:
Create a named region,
Setup the dropdown in a cell.
There is a detailed explanation of the process HERE.