I have 2 sheets:
sheet_a is a styled print-ready layout for a single data record
sheet_b is a bulk data table which is continually growing. Each row corresponds to a single complete record
Currently I am using a VLOOKUP to collect the data from sheet_b and put it in the respective cells in sheet_a. I have a drop down list on sheet_a which allows me to select a single record at a time to view.
Now I want to introduce a second drop down list to sheet_a where I want to select 1 of 4 specific conditions relating to the value of a cell in a specific column of each record on sheet_b.
I only want the entries that meet this condition in sheet_b to be made available in the range of records I can view on sheet_a.
Can anyone help?
As I understand it, you are looking for a way to filter the list that is used in the drop-down on Sheet_A.
add a column to the source data and calculate or mark manually which of the four conditions the record belongs to.
on Sheet_a add a drop-down field where the user can select from the four conditions. Name this cell "criterion"
in the source data table, add a column with a formula that returns the row number if the current row matches the selected criterion. Something like this copied down
=IF(B2=criterion,ROW(),"")
create another helper column that contains only the items that match the criterion using a formula like this and copied down
=INDEX(Data,SMALL($E$2:$E$18,ROW(A1)))
use a dynamic range name called "FilteredList" that contains only the values of the result list, not the errors. The formula for "FilteredList" is
=Sheet1!$F$2:INDEX(Sheet1!$F:$F,MATCH("zzzzz",Sheet1!$F:$F,1))
change the drop-down that is currently used to select a record to source its values from =FilteredList
Related
I have an excel worksheet where I have a number of manual data entry and calculated columns, which is to be filled in line by line with the rows filled from left to right.
I have a few columns which I want to ensure are not left blank as this data entry is carried out.
E.g.
Here I am entering data from left to right on the 3rd row and want to ensure that if the person doing the data entry manually accidentally skips the "Unique ID" column and tries to fill in "Type" first, they will be forced back to the "Unique ID" cell or at least experience a pop-up to tell them to enter in "Unique ID" first.
Is this something that can be done?
This can be handled in different ways; one of which is adding a simple data validation rule.
Add a data validation rule to the 2nd cell that checks whether or not the prior field is blank. If so, don't allow entry in the cell and display a pop-up message.
Data validation rules just have to have a a TRUE result.
Add this formula to a custom data validation rule on the 2nd cell.
not(isblank(c7))
Then, if the user tries to populate the 2nd cell while the 1st is still blank, the user gets an alert message and then the cell contents is cleared.
UPDATE #1
If you need to create a dependency for a data validation list you could add a table to a new sheet to act as your list handler. The basic theory is that one column is filled with an index of each row, a 2nd column checks to see if the criteria has been met, a 3rd column contains every item that could appear in the list and a 4th column is a formula that builds the list based on all of the criteria.
Here is a working example. It's a little different than your scenario but it shows the premise. The example below builds a list of items that can only be selected once. Once the item is selected in a cell, it does not appear in the lists for other cells.
t_FinalPlans_Medical is the name of the table.
medicalRow_FinalPlanSelections is a named range containing the cells that have the data validation rules/drop-down lists.
dataValid_FinalMedicalPlans_OptHeading is a named range holding the column header.
INDIRECT("t_FinalPlans_Medical[[#Headers],[Column1]]")
dataValid_FinalMedicalPlans_OptList is a named range for the index column.
INDIRECT("t_FinalPlans_Medical[Index]")
Index Column Formula IF([#[Unselected Plans]]="","",MAX($D$7:D7)+1)
Final Plan Selections Column
Each cell in this column is manually typed.
Unselected Plans Column Formula
IF(COUNTIF(medicalRow_FinalPlanSelections,[#[Final Plan Selections]])=0,[#[Final Plan Selections]],"")
Column1 Formula
IFERROR(INDEX([Unselected Plans],MATCH(ROW()-ROW(t_FinalPlans_Medical[[#Headers],[Column1]]),[Index],0)),"")
Formula used as Data Validation (dynamically expands) OFFSET(dataValid_FinalMedicalPlans_OptHeading,1,0,MAX(dataValid_FinalMedicalPlans_OptList),1)
https://trumpexcel.com/excel-drop-down-list/
I have one sheet containing the table name customer_id and Project_id.For each customer id various projects are displayed.when i try to create data validation by selecting all those it is not coming.for ex.
Customer_id Project_id
1 1.1
1 1.2
2 2.2
2 2.3
and like that.please tell me some solution.
This really depends on what you want exactly, but since your question is not that elaborate, I guess you mean this?
You can create a data validator from data in your worksheet in the following way:
Select the sheet you want the validator to be on
In the ribbon, click the data tab, and then Data validation
Select 'Allow List'
in the Source bar, select the cells with the allowed values
Another way, is to create a data validator using a vba or vb.net macro. In your macro say:
Dim range as Excel.Range = listSheet.Range("A1")
range.Validation.Add(Excel.xlDVType.xlValidateList, Excel.xlDVAlertStyle.xlValidAlertInformation, Excel.xlFormatConditionOperator.xlEqual, "Option1; Option2")
I guess what you want are two dropdown lists, the second depending on the value selected in the first one? (please elaborate your questions some more). To do that, I suppose there are other ways but this is what I usually do:
Take into account that I always use names to refer to ranges instead of references, to improve readness. If you have doubts to do it, read Use names in Excel formuas
Create a table or range somewhere in your book with one column with the master values.
I have named the range with the values master_list
Create a table or range somewhere in your book with two columns. The first column contains the master/look-up value and the second the dependent values.
I have named the list of look-up values (this is, the values in the first column) as dependent_list
I have named heading to the cell above the dependent_list (for example, if the dependency table starts in A2, the heading is A1
Order the lists
The master_list is ordered as you wish values appear in the dropdown list.
The dependent_list must be ordered by the values in the first column (master values). It doesn't matter if the order is the same in the master_list and the dependent_list, but identical values in the master column of the dependent_list must be together.
The order in the second column of the dependent_list will determine the order in the dependent dropdown list.
Optionally you can define a message to display in the dependent_list when there is no master value selected. I have named it msg_error.
Click on the cell where you want the master dropdown, ant go to the Data Validation menu, where you select:
Allow: List
Source: Add the formula =INDIRECT("master_list")
I have named the cell where the master dropdown list as key_value
Click on the cell where you want the dependent dropdown, and then go to the Data Validation menu, where you select:
Allow: List
Source: Add the formula =IF(key_value="";msg_error;OFFSET(heading;MATCH(key_value;dependent_list;0);1;COUNTIF(dependent_list;key_value);1))
Note that Excel functions are language dependent of the language and I have translated them to English, so maybe there are mistakes.
Currently I am forming a dataset in excel. With the dataset, I am going to do the panel regression using stata(fixed effect model).
However, I cannot change people's names into their unique IDs. In my dataset, I have name in column B, and I want to generate a new column A with corresponding numbers to names in column B. Doing manually is not an option for me since the number of data is larger than 1,000. Two particular problems I encounter are that names are in Korean so the number of characters are mostly the same, and there are same people in different rows. Is there any method that I could use?
If I understand you question correctly, I would do following.
Step 1: Used the Advanced Filter to filter on unique names
You can place these results on the same sheet or on a different sheet (as per Scott Craner's comment). Both options are listed below
Filter Names on the same sheet
Select all the data in column B, then click Data > Sort & Filter > Advanced.
Select the option to Copy to another location, Select a blank cell in column B location at the very bottom of your worksheet, several rows away from your data (since you won't be able to paste the results to a new sheet), and then select Unique records only. Then Click OK
Filter Names on a different sheet
Add a new sheet and the click Data > Sort & Filter > Advanced.
Select the option to Copy to another location
Set the "List range" to the column on your dataset sheet containing the names, and Set the "Copy to" range to B1 on your new sheet
Select Unique records only and then Click OK
This will paste a new range that has all the unique names in your list.
Step 2: Assign unique IDs to the names in the unique list
This can easily be done by entering '1' in the Column C cell next to the first name in the unique list, '2' next to the second name, selecting those two cells, and then clicking the bottom right corner of the selected cells and dragging it down to the bottom of the unique names list
Now you have a range (i.e. unique names and IDs) that you can use VLOOKUP to populate an ID column in your data set
Step 3: Use VLOOKUP to populate IDs for the rows in your dataset
For example, If your unique names and ID is in the range B1200:C1500, then you can enter the following formula in the first row of your dataset in column A (what you want to be the column with your unique IDs)
=VLOOKUP(B2, $B$1200:$C$1500,2,0)
After you drag this formula down your entire dataset, you'll now have the correesponding unique ID for each name.
Step 4: Cleanup
Copy your column A (should be all VLOOKUP formulas) and paste Values only so you don't have the formulas there anymore
Delete the unique data and IDs range at the bottom of sheet (or the new sheet you created to do this)
I have to filter below given excel sheet by a list of 'ID's.
My excel sheet contains thousands of 'ID', in which i have to filter only a particular list of 'ID's. It will take time if I enter values in the list one by one, now how can i filter the list of 'ID's at a time? For example in the above excel sheet how can I filter the list {3,4,11,19}?
You can use Data > Advanced Filter to filter the list. You need to enter the filter criteria in one or more cells. These cells must have the same column header as the column you want to filter on. Typically, these filter criteria cells are created in empty rows above the table, but they can be anywhere else on the spreadsheet.
Click a cell in the data table, select Data > Advanced Filter. Select the filter range and tick to filter the list in place.
The result looks like this:
Note how the blue row headers indicate that there are hidden rows. You can clear the filter by hitting the "Clear" button on the ribbon.
In general you wouldn't be filtering on a list of ID, the whole idea of ID's is for a unique identifier for each row of data making it unique from each other.
You would normally have other columns of "category", "sub category" etc to make the data meaningful.
But saying that , you can use vba to allow you to enter a list of numbers to filter for you.
Create an input box where you enter a list of comma separated values
use vba to create an array of these numbers ,
then set the auto filter with
Criteria1:=Array(var1,var2,var3,var4,etc, "=")
The drawback of Advanced Filter is that you can't display the filter or update it. Each time you want to update it, you must define the Advanced Filter from scratch.
Another solution (which also has some drawbacks) is to create a new filtered range with a formula like this one (inspired from this one-column solution):
=FILTER(A6:D25,NOT(ISERROR(MATCH(A6:A25,Sheet1!A1:A4,0))),"")
Example:
I am trying to look up the value in one column and pull the number from another column.
Of course, I could use the simple V-lookup or Match.
However, the first column of data has multiple entries that are the same. If I Vlookup it is just going to pull the first number in the second column.
I need to pull each number from the second column and somehow add them together. Despite the fact I have multiple entries.
If there is a way to consolidate the multiple entries in 1st column while also summing up the numbers in the 2nd, that would be great.
I would recommend a Pivot Table. To create one, select a cell in your data range (which needs to have column names in the first row. Choose Insert / Pivot Table from the Ribbon and select the New Worksheet option for the location.
In the Pivot Table list on the new worksheet, drag the name of the first column to the Row Labels box and the name of the second column to the Values box. The name in the Values box should turn to Sum of <2nd column name>.
The Pivot Table will now show a sorted list of the column 1 values and the summed values of column 2. In the example, you'll see that
Does SUMIF do what you are looking for?