Reputation: 2422
I am working on an Excel file where This is my First Table.
Now I have another table that has exactly the same Column names
Now What I wanted is When the Value of Table1[Status]
is Active
or Pending
it should fetch all the values in Table 2
. and Don't do anything when the Status
value is Pending
or Empty
The Expected Output
I have tried the following query but I think I am doing it wrong.
=XLOOKUP([@GID];Table1[GID];SWITCH([@[Status]];"Active";Table1[Status];"Pending"))
Does anyone know how to solve this challenge?
Upvotes: 0
Views: 70
Reputation: 3257
Solution 1
A formula based solution cannot display the output in a Table.
Suppose your first table is called Tbl_Source, enter the following formula (in Excel 365) in a single cell and you will get the desired output:
=FILTER(Tbl_Source,(Tbl_Source[Status]="Active")+(Tbl_Source[Status]="Pending"))
Solution 2
If you want to show the filtered output in a new Table, you can try using the Power Query function which is built into Excel 2013 and all later versions.
Firstly, highlight any cell within the first table, then load the table to the Power Query editor:
Secondly, click the filter button on top of the Status column, and select the desired criteria as you would normally do in Excel:
Lastly, Close and load the output table. By default, Excel will load the output to a new table on a new worksheet. You can cut and paste the output table to the desired worksheet, or Google how to load the output to a query and then choose where exactly to load the output to.
If you want to add additional data or make changes to the first table, you need to right-click any cell within the output table and choose Refresh, then the output table will be updated with additional data.
Let me know if you have any questions.
Upvotes: 1
Reputation: 481
First
Then (Choose Table)
EVALUATE
CALCULATETABLE(
Table1,
Table1[Status] ="Active" || Table1[Status] = "Pending"
)
Upvotes: 1