How to create dropdown from existing data? - excel

One of my worksheets (Sites) contains a list of sites.
Column B contains the sites unique ID, Column C contains the site type.
This is an example, the real data will have many more entries.
Eg:
Column B Column C
1234-56789 NW175
5468-58754 SW124
8787-97979 PO962
9247-75204 NW116
1458-56155 NW120
7486-89251 KA960
975-983044 PO630
I'd like to be able to present a dropdown list in cell A5 on worksheet 1 (Home) containing only entries starting with NW.
I'd like the list to appear as:
NW175 - 1234-56789
NW116 - 9247-75204
NW120 - 1458-56155
Is there any way to do this without using macros?

If you are using Excel 365 then you can use the new FILTER-Function.
Also I would propose that you use a table to define your site-configuration.
There you add a new column, e.g. Full name and apply the formula to concatenate both values.
Then the new FILTER-function comes into play - see my screenshot - you have to use the formula =FILTER(tblSiteInfo[Full name];LEFT(tblSiteInfo[Site Type];2) = "NW") --> the filtered result spills down as a new list
Next step: define a name for the cell (and only the cell with the formula) and apply a # at the end of the name-address.
You can then use this name for your validation list.
Benefit of this solution: if you add more sites to the configuration table the validation list will update automatically.

To concat strings with cell variables use & operator. According to your example paste this =C2&" - "&B2 to column D for example D2 and pull down to apply rest of rows below.
For creating a dropdown menu from concatenated data follow these steps.
1 - Select the cell where you want to create dropdown list
2 - Go to Data tab
3 - Click to Data Validation
4 - Select List from Allow dropdown
5 - Click Source and mark column D for example =$D$2:$D$8
6 - Click Ok

Related

ungrouping Excel data saved as an Outline as a pivot table

I do not know if it is possible to do what I want to achieve in Excel, but I have the data that is generated in the Outline (let's assume: on the left side of the screen I have a "plus", if I press it, I have another "+" and I get to the next detailed data.
The problem is, when I ungroup it all, I have every item in column "A" and I can't make it into a PivotTable.
What I mean?
Example (you can see it in the photo).
1 "plus" - country:
[![enter image description here][1]][1]2 "plus" - city:
3 "plus" - brand of items sold
4 "plus" - exact equipment from this brand
When I ungroup it, everything is in one column and it should be - respectively - 1 "plus" - column A, 2 "plus" - column B, etc.
Is there any possibility to ungroup it according to the "pluses".
I hope there is any sollution...
Thanks
See https://www.mrexcel.com/board/threads/calculating-outline-levels-in-excel.227279/#post-1112028 copied here:
Select cell A1 of the sheet,
Do menu command Insert/Name/Define, and create a name called DetailLevel, with a formula ( in the Refers To box ) of:
=GET.CELL(28,Sheet1!A1)
( alter the sheet name Sheet1 to whatever your sheet is called )
Now in any blank column of the sheet type the formula =DetailLevel and copy down.
That will give you 1 for no indent, 2 for level 2, 3 for level 3
bring that along as data column to create pivot table

Is there a Excel Formula for auto filling a price when certain option of choices is picked?

I am working in Excel. I am trying to come up with a formula that is linked to a drop down menu of choices. I have attached an image below that shows a 'Status' column and 'Double Handling' column. My end goal is when you click a status option the corresponding price gets autofilled in the double handling column.
For example Status :Price
Unchecked :$400,
Checked :$600,
Laydown :$200,
in SWO :$200,
Progress :$200,
Paint :$200,
Laydown :$200,
Site :$200,
If you have your Drop Down options on another tab (a Lookup Sheet), then you can put the Price next to them, and use a VLOOKUP
=VLOOKUP(A1,LookupSheet!$A:$B, 2, FALSE)
This also lets you use a Named Range in your Drop-Downs, so that you just have to add or remove items to the Lookup Sheet, and it will automatically update all of your options. The Named Range would need to contain a Function that used INDEX to set the range, like this:
=LookupSheet!$A$1:INDEX(LookupSheet!$A:$A, MAX(COUNTA(LookupSheet!$A:$A), 1))
(If your Lookup Sheet includes a Header Row, then you will probably want to change $A$1 to $A$2, and that final , 1)) to , 2)) instead)
If you don't want to use a Lookup Sheet, you can include the Lookup Table in the function as an array:
=VLOOKUP(A1, {"Unchecked",400;"Checked",600;"Laydown",200;"in SWO",200;"Progress",200;"Paint",200;"Laydown",200;"Site",200}, 2, FALSE)
The whole array goes inside braces (curly brackets, {}), values on the same Row are separated with Commas ({Input,Output}), and Rows are separated with Semicolons ({Input1,Output1;Input2,Output2})
Though it may seem a bit lenghty, if for whatever reason you want to change up amount, I believe you could nicely implement CHOOSE here:
=CHOOSE(MATCH(A1,{"Unchecked Drawing","Checked Drawing","in SWO","Progress Assign LamSar Shop","Progress Assign Subcontractor","Paint","Laydown","Site"},0),400,600,200,200,200,200,200,200)
Range A1 in my formula refers to the cell with the drop-down. Also, when empty, there will be an error (since MATCH cannot find a match). You could counter that with wrapping the formula in an IFERROR(.....,"").

Create dynamic search box instead of Ctrl + F

I’d like to create a dynamic search box at the top of my master sheet (Sheet 1) instead of using the “Find” command, Ctrl + F. It would search column B and output info from the corresponding cell in column C.
The search box/cell would be dynamic, so as I type into it, it would pre-populate from a master list (Sheet 2), without having to hit ENTER or an OK button.
I’d like the search box/cell to be in A1
I’d like it to search column B data. From B2 to the end (row can change): B2:B
The result would be the data in column C:C2:C
Not sure if I should use the QUERY or ARRAYFORMULA function. Appreciate any thoughts on how to set this up.
how about this:
=JOIN(CHAR(10), QUERY({B2:C}, "select Col2 where Col1 contains '"&A1&"'", 0))
demo spreadsheet
I think I figured it out!
Sample Sheet
Search Box (A1): I used Data Validation. It is dynamic as I type and lists the master list of items in column A
Search Results (B1): I used VLOOKUP
Thanks, #player0, for suggesting the data validation! Really helped :)
Only issue is that I sometimes have multiple values in Column B (Item). For instance, I have "lemon" listed twice. I'd like the output in B1to show all other results. They can show in B2...Any suggestions?
EDIT: For the issue of multiples in column B, I decided to change all items in Column B to a unique identifier.
paste this in C2 cell:
=QUERY({B2:B}, "where Col1 contains '"&A1&"'", 0)
and set up dropdown data validation from B2:B range in A1 cell
demo spreadsheet

How can I make a drop down list that stores an index value in a hidden field?

I have an Excel spreadsheet where on Sheet 1 the Department Id is represented as a number and where on Sheet 2 there is a list of those numbers with the Department Name next to them.
If possible I would like some help and advice as I want to allow the user to select the Department Name from a drop down list and have it populate a hidden field with the department number.
Something like in Sheet 3 with the Department Id being stored for example in the C column on that page:
Sheet 1
Sheet 2
Sheet 3
This could be one approach.
If I have understood you correctly, the user will select the department name in a drop-down list in Sheet 3 and and the index number associated with that department name will appear. The user will not be limited to what name (andy, bob) it is in the adjacent column...
Result will be (notice this is a Excel Table!) :
We have the 3 sheets:
Select the data areas and click on "Format as Table", Select the option "My data has headers". Do this for all the 3 sheets.
Name your tables: "Design" -> "Table Name". I will use "Table1" for "Sheet1", "Table2" for "Sheet2" etc. It will make life easier when you link and refer in formulas. Notice that for "Sheet3" I also add a dummy column C. I name it "Index Number".
Go to "Sheet2" and select the range that you want to use as your drop-down list (in my case i choose Department Names and selected "B2:B8". Click "Formulas" -> "Name Manager" -> "New..."
This window will pop-up. Name it an easy name (I named it: "Department_Names") and check that the "Refers to:" is in this format "=TableX[Column Name]". In our case =Table2[Department]. Notice that the name manager don't use "B2:B8", rather is reference to the table column area. The last step is very important!
Go to Sheet3. Click on cell where you want to apply the drop-down list (I use B2 in the example). Click "Data" -> "Data Validation".
Data Validation window will now pop-up. Go to "List" and in the field "Source:" you write your named range as =Department_Names (the one I named "Department_Names"). The drop-down list will use the values in the range that "Department_Names" are applied to. In our case it will make a drop-down list of all the department names from "Sheet2", range B2:B8.
Go to "Sheet3" and enter the formula below in the cell C2 as shown in the picture.
Notice I use " ; "as delimiter (European version of Excel, US user will probably use" , ").
=IF([#Department]="","",IFERROR(INDEX(Table2[ID],MATCH([#Department],Table2[Department],0)),))
The first part creates our Index number:
...IFERROR(INDEX(Table2[ID],MATCH([#Department],Table2[Department],0)),)
Return the Index number from "Table2", Column ID. INDEX(Table2[ID]
lookup value in the MATCH formula comes from "Table3", Department
(drop-down list)
The lookup value will look in "Table2", column Department.
Will take care of 0 that will be created when nothing is selected in the "Table3", Department column (see next picture for example)
=IF([#Department]="","", ...formula...)
Formula without the =IF([#Department]="","", ...formula...)
You can hide the "Index Number" column in "Sheet3" if you don't want to have it visible.
Right click on the Column C header and choose "Hide".
Only for demonstration purpose here. I create a dummy column "Only for show hidden column values". So when the user selects a Department name, it will change the index number associated to that department.
So why the use of tables and named range?
Let's say you need to add a new department. We add a department in the "Table2" and we give it ID: 7 and Department Name: Department H.
What happens in your "Sheet3" is that the drop-down list will automatically catch the new row. The range named to "Department_Names" will adjust to the table rows because it's linked to "Table2[Department]". This is also true if you decrease rows for Table2. Source
I have not tested it, but I'm quite sure that you can link a table to an external source. So when you import your data to the table (given the headers is static) the table will be updated with "Refresh All" button in Excel. Something to explore and look further into :)
It can be done with INDEX/MATCH.
As an example:
Sheet1 contains your lookup table.
For simplicity sake Sheet1 has numbers 1 - 6 in the range A1:A6 and A - F in the range B1:B6.
1 - 6 are the primary keys and A - F are the descriptions.
Sheet2 has Data Validation in column A: Allow List using =Sheet1!$B$1:$B$6 as the Source. This will give you the drop-down in column A.
In column B, which is hidden, you have the formula =IFERROR(INDEX(Sheet1!$A:$A,MATCH($A2,Sheet1!$B:$B,0)),"")
The MATCH formula will return the row number in Sheet1 that the description appears in.
The INDEX formula will return a reference to the cell in column A on that same row - giving the Primary Key value.
If no match is found then #N/A is returned which is dealt with by the IFERROR statement.
This method will work if your departments are less than equal to 32.
In UTF 8 characters from code 128 to 160 are hidden (among many others). You can use these characters as your id key, you have to just concatenate them with your department name.
This is a screenshot of excel
3rd column is the Unicode character, 4th is concatenation of this character and the department name and last column is extracted id from the new department name.
These are the formulas
At the end it can also work if your departments are more than 32 but you have to find another slot of non-printable characters
You have to use the new department names as data validation drop downs where department entry is required and can extract the id from the entered department

excel reference to another work book multiple sheets

I am trying to use a formula that would let me copy and paste it down so I dont have to link every-time
The source workbook has tabs named 1,2,3,4,5.....100
I want to use simple formula ='[test.xlsx]1'!$O$117
but I want to replace ='[test.xlsx]**A1**'!$O$117
so it is dynamic and I can copy it down
='[test.xlsx]B1'!$O$117; where B1 = 2
='[test.xlsx]C1'!$O$117; where C1 = 3
I tried ='[SCD PCAP 2Q15 - waterfall.xlsx]&1&'!$O$117
any ideas?
You can do so by Two step process.
Step 1 (Thanks to #Excel Hero for this answer)
1
Open the Name Manager. Control-F3 from the worksheet, and then click the New button.
2
For the Name field in the dialog, enter EVALXFD. I just picked this name it is using column XFD in it. But you can pick whatever name you like.
3
For the Refers to field, enter this
=EVALUATE($XFD1)
4
Click OK and then Close.
Step 2
Paste below mentioned formula in last helper column XFD (I am assuming you are not using this column)
=CONCATENATE("='[Test.xlsx]",$A1,"'!$A$1")
In B1 enter this formula and drag it down:
=EVALXFD
That's it.
Use the INDIRECT() function. E.g., with $A$1 = 2, $A$2 = 3, ..., you can use
=INDIRECT("'[test.xlsx]"&B1&"'!$O$117")
which Excel will concatenate =INDIRECT('[test.xlsx]2'!$O$117) and then evaluate.
Note also that I've written the references above based on copying the formula down column B (with references in column A), so the row number will change, but the reference will always be to column A.

Resources