Is it possible to populate two columns simultaneously? - excel

I have a lookup table with three columns:
ID Brand Product
1 Dell Computer
4 HP Printer
I have to fill one more table as follows :
ID Product Brand
1
On click of Product the following formula: =VLOOKUP(A2,$E$4:$G$7,3,FALSE) will populate the Product as Printer. I want the corresponding Brand also to be populated on click of Product. The value to be populated should be HP.
I tried using the formula =VLOOKUP(A2,A3,$E$4:$G$7,3,2,FALSE) but it says Too many arguments.
Is it possible to populate two columns simultaneously?
If not possible using VLOOKUP, is there any other way of populating multiple cells by clicking on some other cell?

One way to populate multiple cells by a single click is to use a Form Control. In the example, G2 is populated with:
=IF($A3,VLOOKUP($A3,$A:$C,COLUMN()-5,0),"")
with this copied across to H2.
In 'A3' is a Check Box linked to A3:
A single click on the Check Box should then display:

You cannot populate a cell with a formula in another cell. You need one formula for Product and another formula for Brand.
For Product you have =VLOOKUP(A2,$E$4:$G$7,3,FALSE), which returns the value in the third column of the lookup table.
For Brand you want to return the second column of the lookup table. Therefore, you need this formula in the Brand column:
v-- This is the column you want to return
=VLOOKUP(A2,$E$4:$G$7,2,FALSE)

You could concatenate two VLOOKUPs and have both values in on cell like so:
=VLOOKUP(A2,$E$4:$G$7,2,FALSE)&" "&VLOOKUP(A2,$E$4:$G$7,3,FALSE)

Related

Hey I have one column with multiple categories like a,b,c and other column with corresponding numbers to a,b,c , How can we calculate median

I have a table containing columns like category and values
I want to find the median of individual category I tried the "=median and if formula", it is working if I have two categories only if I have 3 like below data it does work, I want to do this without using pivot table actually that's a constrain
Categories
Values
a
5
b
4
c
9
c
10
b
6
a
2
c
11
b
7
a
3
b
8
I tried to formulate my requirement on the table but I guess there is some problem with the formula here
=IF(A2:A11="a",MEDIAN(B2:B11),IF(A2:A11="b",MEDIAN(B2:B11),IF(A2:A11="c",MEDIAN(B2:B11))))
Apart from this I tried the pivot table as well by using add measure it worked but I don't know why is it not working through formula
if you want to drag the formula then take unique categories and apply the formula.. in F2 cell
=MEDIAN(IF($B$2:$B$11=E2,$C$2:$C$11,""))
Your condition part of the if statement is returning an array. Don't use IF()...
You need to filter the column A.
=MEDIAN(FILTER(B1:B11,A1:A11="a"))
=MEDIAN(FILTER(B1:B11,A1:A11="b"))
=MEDIAN(FILTER(B1:B11,A1:A11="c"))
Try the following formula for spill down array. You do not need to drag down, no need to put formula to individual cells.
=LET(x,UNIQUE(A2:A11),y,MAP(x,LAMBDA(a,MEDIAN(FILTER(B2:B11,A2:A11=a)))),HSTACK(x,y))
You can achieve this using a Pivot Table, along with the build-in (Excel-2013 and higher) Power Pivot option to include your own measure:
Select your data, and in the 'Insert' tab, click 'Pivot Table' in the 'Tables' group;
Make sure to tick the 'Add this data to the Data Model' option and hit 'OK';
Then go to the 'Power Pivot' tab, (or enable it first if you haven't). Under the 'Calculations' group, click 'Measures' and choose to add a new one;
Choose an appropriate 'Measure name:' and use the following formula: =MEDIAN([Values]);
The Pivot Table should be selected, just click 'Categories' which will auto-populate the labels.

Dependent Dropdown lists and Offset formulas

I have a sheet with a price list for many items, all of them have a column for category and another column for core product, secondary or third. I then have description, price etc.
I have built an Invoice configurator that when the user selects a category it comes up with an offset formula for product (description) and a bloom up formula then brings up the item code, price etc.
I have an issue where I am trying to get the spreadsheet to allow me to have the following.
1. Dropdown for product type.
2. Dependent Dropdown for category
3. Dependent Dropdown for product type
4. Then the offset formula to look at all 3 Dropdown options and only provide me with those products.
Does anyone have any ideas?
Thank you in advance
You can create dependant dropdown menus with named ranges, data validation and INDIRECT formula. Then use FILTER formula to extract the products corresponding to the 3 selected options. I've made a tiny example :
With blue background, the dropodown menus (2 dependants). On the right, the named ranges. On top, the data. With green background, the output (1 result only since my sample DATA is very small).
EDIT : You want a dropdown menu to select the results (after the user has done his 3 choices). You can use TEXTJOIN to build a list from the results and then create another dropdown menu (dynamically resized). If you want something more "transparent" (no table of results to hide), it's possible to replace the FILTER formula with SUMPRODUCT and MATCH (the TEXTJOIN column will be placed in the original table and might cause slowdowns if the number of items is too big).
Sheet

How to replace comma separated values to comma separated ids in the same/individual cell in excel?

I have a table where Products are mapped with ingredients and another table where Ingredients are mapped with IDs like this below :
Below is what I need :
Here I want to replace the comma separated ingredients values in "Data Table" with their IDs from "Master Table".
I checked out Replace Function to accomplish this task but couldn't manage to do it somehow.
=REPLACE(C2,1,LEN(C2),..
Here C2 i.e. Ingredient column in "Data Table" doesn't have single value to replace it easily, they are available in combination for which replace statement is not the correct solution although the same can be handled programmatically but I want to do it in excel way.
It would be very grateful if someone can guide me with solution to this problem.
Thanks in advance.
This is not a direct solution nor a VBA solution but through a manual action and 2 simple formula's, this is possible.
I used a combination of Data>Text to Columns, VLOOKUP and Concatenate functions to achieve your result table.
Step 1.: Delimit your data using Text To Column.
Step 2.: Add VLOOKUP Functions for each ingredients.
Step 3. Use the Concatenate function to bring all the VLOOKUPS together.
You can find my solution using your example here in a Google sheet:
The only thing I can come up with is a nested SUBSTITUTE function like this one:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(C1,D1,E1),D2,E2),D3,E3),D4,E4)
Here your Ingredients are in Column D and their respective IDs in Column E (i.e. your Master table in Sheet 2).
As you probably have many ingredients, you can use CONCATENATE to create the correct formula. Assuming your have your recipe in column E, your ingredients in column F and the corresponding ingredient IDs in column G:
Write SUBSTITUTE(E2,F2,G2) into D1 (where E2, corresponds to the first entry in the Ingredients column in your data table, F2 corresponds to your first ingredient in your Master table, and G2 corresponds to the related first Ingredient ID in the Master table)
Write SUBSTITUTEinto A2
Write =ADDRESS(ROW(F3),COLUMN(F3),4) into B2 (where F3 references your second ingredient in your Master table)
Write =ADDRESS(ROW(G3),COLUMN(G3),4) into C2 (where G3 references the corresponding ID to the second ingredient in your Master table)
Write =CONCATENATE(A2,"(",D1,",",B2,",",C2,")") into D2
Drag A2:D2 down as far as necessary
You now have the necessary formula. Copy, paste the last entry, selecting Paste Values and set a = in front.

Dependent List in Excel

My question is , in excel when we create a dependent dropdown we write the formula for the other dropdown dependent on the first one. For example if USA is selected in first col the matching City of USA will be pulled and then can be populated in a data validation list.
I know how to write formula to get the items matching criteria. My problem is what if we have multiple dropdowns .
For example we have 100 rows with column A for selecting Countries and then next to each of these we have dropdown for selecting City.
Do I need to write 100 formulas for these dependent dropdowns or there is another way around to achieve this?
Consider the following,
        
The data validation lists in A2:A10 are based on a List with a Source: of,
=$AA$2:$AA$5
The data validation lists in B2:B10 are based on a List with a Source: of,
=INDEX($AB$2:$AE$6, 0, MATCH($A2, $AB$1:$AE$1, 0))
sample workbook

relational drop down in excel

I have a drop down of 4 fields in Column A
In column B I have 10 fields which are associated to one of the 4 fields of column A
Similarly I have Column C, where the values are associated to one of the 4 fields of column A
How can I have a relation If I have 3 drop downs where I slect a Column "A" value it gives me related list in the next 2 drop downs.
please help
This is called dependent data validation. There are several possible approaches. Debrah Dalgliesh has a very good tutorial at http://www.contextures.com/xlDataVal02.html using named ranges and the Indirect() function.
If you need to populate two different drop-downs from one selection, call them Value1 and Value2 based on the Value in the first drop-down and use Indirect(A1&"1") and Indirect(A1&"2") respectively. Like this:

Resources