Table with auto-generating data in excel - excel

I have four columns, employee, role, discipline and available from created in A1,B1,C1, and D1. I selected the four cells and the four beneath in A2, B2, C2 and D2 and turned it in to a table. I then pasted the following formula which is used to pull data together from two other tables in to A2 but unfortunately I get a spill error -
=FILTER(VSTACK(FILTER(M3:Q50000,M3:M50000<>""),FILTER(S3:W50000,S3:S50000<>"")),{1,1,1,0,1})
Is it possible to construct a table in this way?

If you really want to keep using Excel table, and you want to populate specific column that uses an array formula, such as UNIQUE or any other spill formula, you can create a Hidden tab (hide it if you want) where you use UNIQUE for example, then to refer in your Excel Table to your calculated array. Let's say the first element is: HIdden!A1, then you populate your table expanding down the formula.

Related

How to paste one occurrence of filtered category to a new column in EXCEL

I have a table with several rows for each category(column) and a corresponding score for them in excel. I want to get the sum of all scores for each category(I will use the SUMIF formula). I want to know how to extract one occurrence of each category name onto a separate column without manually typing it. Is there a formula or a shortcut that I could use?
This can be easily achieved by using the UNIQUE function. Suppose you have the following data as an example in the range A1:B8:
Now simply copy your headings into, e.g., the columns D:E and enter the following formulas in the cells D2 and E2 respectively:
=UNIQUE(A2:A8)
=SUMIF($A$2:A8;D2;$B$2:$B$8)
Adjust the arrays to your needs and you should have solved your problem. The final output looks as follows:

Fill formula column wise when drag down by column in Excel

I want to fill up a column of values using xlookup(). Please see the example below.
Typically the formula will automatically change parameters as I drag down the column but it only works if Var1-Var6 are populated by rows. But in the raw data Var1-Var6 are in columns (and cannot be easily transposed due to other constrains). I am wondering how I can make the formula automatically loop through column B to G when dragging down the column.
Use INDEX:
=XLOOKUP($J$4,$A:$A,INDEX($B:$G,0,ROW($ZZ1)))
Now as it is dragged down it will change which column is returned.
with Office 365 we can also use filter and transpose:
=TRANSPOSE(FILTER(B:G,A:A=J4))
put that in the first cell and it will spill the results

Function in VBA for multiple filter

Can someone help me write VBA function to get data from another worksheet using multiple filter?
Data looks something like this.
I want to write a function that extract the A1 or A2 or A3 value based on the dropdown I select. If I select A3 it should pick data from A3 column. My Filter criteria on other columns are Item, id and location. Column for Item, id and location are static. While column for A1, A2, A3 are dynamic. I want to put criteria on Ite, id and location. These are the three criteria and result should be from the fourth column. i.e. either A1 or A2 or A3 based on what I select.
I tried but couldn't figure out. Can someone help me on this, please?
You don't need VBA for this but you do need to make a few preparations. I will show here what I did. There are other ways and you can choose the way you prefer.
I created a table exactly as you posted. Instead of a table you can just create a named range or you can replace the names of either in the formulas with the range's coordinates. I didn't name the table but recommend that you do if you use a table. In my example the table's name is Table1.
Within the table I created a named range comprising the cells D1:F1. I called this range "Data" but any other name will do as well. You may also move the named range entirely elsewhere if you want different captions for the columns for one reason or another. As you will see, the names are insignificant they are used to create the numbers 1, 2 and 3 from the location where they are within the named range Data.
Now I created a validation drop-down referring to a List of =Data. The effect is that I have a drop-down with A1, A2 and A3 in it. I created this drop-down in A10 of a different sheet from the one on which I have Table1.
Now I used the following formulas to extract data from row 2 of the table.
=INDEX(Table1[Item],2)
=INDEX(Table1[Location],2) or =INDEX(Table1,2,3) and
=INDEX(Table1,2,3+MATCH(A10,Data,0))
Observe that every "2" in the above formulas refers to the 2nd row in the named range Table1. I didn't set up a range of that name but that is something Excel threw in when I created the table. However, you would like to pull data from other rows as well.
For that purpose you can use the ROW() function. This function returns the number of the row in which it resides. If it's in row 10 it will return 10, in row 11 it returns 11 etc. It's a counter. Therefore, if you entered my formulas in row 10 you can replace all the "2"s with Row()-8 and as you copy up or down you will get data from different rows, same columns.
=INDEX(Table1[Item],Row()-8)
=INDEX(Table1[Location],Row()-8) or =INDEX(Table1,Row()-8,3) and
=INDEX(Table1,Row()-8,3+MATCH(A10,Data,0))
If your first formula isn't in row 10 you must adjust the number to be deducted according to where your formula was entered.

Excel - How can you find the exact match of a table row in a separate table if it exists?

I have a spread sheet with two tables:
I want to find every "row" in table1 that exists as an exact match in table2 using a formula. For example, you can see I have one row in the "matches" table to the right.
So far, I can check for exact matches on a per row basis(this is an Array formula entered using ctrl+shift+enter):
=AND(EXACT(A3:B3,D3:E3))
How can I do that for the entire range in Excel?
Using a helper column. In F3 put this formula:
=IF(COUNTIFS(A:A,D3,B:B,E3)>0,MAX($F$2:F2)+1,"")
and copy down. It will fill all duplicates with an increasing number.
Then you can use this formula in G3:
=IFERROR(INDEX(D:D,MATCH(ROW(1:1),$F:$F,0)),"")
Copy it over one column and down sufficient for your needs.
It will populate the list with all duplicates.

Update table with another table based on cell value

After searching, I understand I can copy data into a table one at a time using VLOOKUP. However, is it possible to replace an entire table with another if a cell contains a certain value?
For example,
I have a table1. I want to replace table1 with table2 if cell a1="table2"
The reason is I will have many tables and depending on what I put in a cell, A1, I want table 1 to be what ever table I choose. I also want it to be easily updated when I add even more tables.
Edit for more information:
I have one table lets call it table1. Another table, Table2, with columns Name and Values. Also I plan on having more tables, so Table3 with columns Name and Values. I have a cell somewhere on the page, or another page. If I write Table2 in this cell. I would like the entire Table1 to be replaced by table2. Ultimately copying the data in.
I have tried structured tables, but it only copies from the same row. If I put it in another row, i get null basically. Vlookup, I think requires me to have a formula for each row of the table. I might be using this formula wrong.
Without knowing more, one solution is INDIRECT().
Example workbook sheets:
Table1
Table2
Table3
Assume all Table# tabs have the same cell range.
Make a new tab Input:
[A] [B]
[1] User Input
[2] Table # 1
[3]
[4] Reference ="'Table"&B2&"'!"
The formula in B4 evaluates to 'Table1'!. Note that the sheet reference includes the apostophes in case the sheet name has spaces.
Make a new tab Summary Table:
[A]
[1] =INDIRECT(Inputs!$B$4&ADDRESS(ROW(),COLUMN()))
This formula displays the value in the specified sheet name (from Inputs!B4) and the current row and column (so when this formula is entered in A1, it will display the value of Table1!A1). Then fill this formula across the rows and columns necessary to display the table specified in the Input tab.
Note of course that you could combine the Input and Summary Table tabs, but you would need to adjust the ROW() and/or COLUMN() formulas. This is also the case if your source tables do not begin in cell A1.

Resources