I am wondering if it is possible to hide columns based on the selection of a drop down list using excel.
For example say i have 3 columns( C1,C2,C3) and i have a drop-down list with 2 values(drop1 and drop2). When drop1 is selected from the dropdown list then show C1,C2 and hide C3. When drop2 is selected show all Columns C1,C2,C3 . Does anyone know if this is possible in excel ?
Here's an example of hiding columns via VBA. You'd need to write code much like that.
Mind you, I'm assuming that when you say "excel" you actually mean within the excel application. If you're generating the Excel file programmatically, you could easily use similar code via the OpenXML API.
Yes this is possible (very short answer).
Use VBA for it in which case you will have to link the drop down value to either a cell (and use Worksheet_Change to see if the particular cell has taken the required value for hiding the column or not (in which case hiding should be undone).
Related
Are there any ways to add lenovo dropdown in one cell based on what user put in this cell without VBA?
For example, dropdown options: {"abc","bcd","cde"}, if user input "a", then dropdown will be "abc" only.
You mean you want a searchable drop down list and that without VBA. There can be two ways your search will take place
either
it will filter all data having a which I feel is a better option
OR
you just want to check if the fist character of ur data starts with a which is very simple by checking =left(text,1)="a" test.
But that is just the logical test involve. The real challenge is to should know how u can create a named dynamic range which only will pave ur way to searchable drop down. U said to avoid VBA. The video m referring to is without VBA.
https://www.youtube.com/watch?v=8z1g1mqXyrk
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.
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.