Fetch value based on Filter values - excel

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?

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.

First
Then (Choose Table)
EVALUATE
CALCULATETABLE(
Table1,
Table1[Status] ="Active" || Table1[Status] = "Pending"
)

Related

Get data source row number of Pivot Table Active Cell

I need to find a way of determining the row number from the data source table of the selected cell in my pivot table.
The reasoning behind this is that I want to be able to edit/update the values from a UserForm.
My table with the data source is in sheet 1 named Data and my pivot table is in sheet 2, named Project management.
I know I can edit values in a Pivot Table by setting
EnableDataValueEditing = False
..but this does not give me the desired result since my original data remains unchanged and I also have hidden columns that I use for conditional formatting only and it would be a bad user experience to have to unhide the columns every time I need to edit them.
Does anyone have any idea or suggestion as to how I can retrieve the original data row number for a specific cell in my pivot table ?
As an example, the top is my original table and the bottom right is my pivot table. When the cell "Dummy Data" is pressed, I want it to give me the Row number of that data from my original table.
A "bad" workaround would be to use VBA to match the selected cell
value with the data from the table and when the match is found,
retrieve the address but this is not foolproof, the data should be
unique but with more data flowing in over time, this might not be the
case anymore. Therefore I am trying to avoid this method.
PS: if someone could edit my post and embed the image, I would highly
appreciate it.
A pivot table is a report summarizing information from the linked table or query. The only ways you're going to be able to update the information is if you know the row ID/number you want to change or filter the data source down to a point where you can identify it.
If you're going to be keeping and altering records, I'd suggest building a database (Access, for something quick and easy) to enforce some form of integrity and then link your pivot table and form to that database.
EDIT: VLookup or Index(Match(...)) is only going to return the first hit and that may not necessarily be what you want.
I will put my non-orthodox but perfectly functional way of doing it just in case someone is facing a similar issue or until a better way arises.
I have actually added a new column in my data table with the formula
=ROW([#Column1])
This gives me the row number for every entry.
Next I am just adding that column as a row in my pivot table, display in tabular mode to have it's own column and hide it. Therefore when selecting a cell, I am looking in the hidden column for the number and therefore I am getting the source data row number.

Get slicer selection of a data table

I have been struggling with this issue in the past days and haven't found yet any solution.
I have a simple table (not a pivot table) and some slicers attached to it. I want to 'simply' show selected value/values of the slicer in a cell. It implies of course to make the cell update automatically according to the selection.
Some of the solutions I found suggested using two pivot tables, one main for the regular data and the other hidden to capture the selected filters. The problem is that I am not working with a pivot table, but rather a simple table.
I also tried getting distinct values of the table column, but I couldn't perform it properly without getting the hidden values of the filtered table too.
Is there any way in Excel to do this simply?
Thank you!
You can follow the below steps to achieve your result
You will have to insert a serial number column in your table
After that insert the below formula above the header or anywhere you want to display the selected value
The formula in C2 is
=INDEX(Table1[Data 2],SUBTOTAL(5,Table1[S.No]))

How to properly index match using dates between two different tabs

I am trying to automate a report, but I am running into some errors when trying to use index match to report data for matching dates between to excel sheets.
In the pictures below, I want the table to be populated when data is pulled in another tab and the dates in the table match the ones in the tab where the data is pulled. For instance, where it says 'Mar-18', i want to report the data from the 'ACT STND PRODUCTION' line in the SPI Performance tab where it says '03.2018'.
Graph tab
SPI Performance tab
The first tab is called Graph and the second is called SPI Performance. Right now , I have =INDEX('SPI Performance'!C6:C14,MATCH('SPI Performance'!$B$10,'SPI Performance'!$B$6:$B$14,0),MATCH(Graph!D26,'SPI Performance'!K5,0)) for the Mar-18 box in the table, but i am getting an error.
Thank you for any feedback you may have!
Please try this formula to see if the cell will populate correctly:
=INDEX('SPI Performance'!$C$10:$K$10, MATCH('Graph'!D26,'SPI Performance'!$C$5:$K$5,0))
If you enter that formula in cell D27 on the "Graph" Sheet then drag it to the right through column M the answer should populate based on the ACT STND PRODUCTION line in the 'SPI Performance' Sheet.
You can alter the ranges $C$10:$K$10 and $C$5:$K$5 as needed depending on how large your range needs to be.

Pull a list of names assigned to a specified trainer in Excel

I want to pull a list of people assigned to a particular trainer. In column A I have the trainer name, In column B the Last Name, In Column C the First name. I'd like a list in a different column which sorts the names under the name of their trainer. I've attached a picture of what I'd like. I typed in the information manually, so don't be fooled into thinking that I've already got what I want. I'm thinking that I might need to use Vlookup, but I'm not sure that's right or exactly how to do it in this case.
Thanks!
Here's the array formula to go into cell N2:
=IFERROR(INDEX(Table1[[#All],[Full Name]],SMALL(IF(Table1[[#All],[Trainer]]=N$1,ROW(Table1[[#All],[Trainer]])),ROW()-1)),"")
For this to work, you need to:
First turn your data into a table. Click any cell in your data then click on Insert > Table.
Copy the formula, then double click into cell N2, paste the formula and instead of pressing just Enter to save the formula, you need to press CTRL+SHIFT+ENTER. If saved correctly the formula will appear with {Curly Braces} in the formula
Fill the formula down enough rows to include all trainees. Then fill the formula across the columns for the other trainers.
It can be done a few ways:
Repeated applications of the Advanced Filter that saves the results to different locations. This is tedious to update.
Write VBA. This takes a while to learn.
Use an array formula. This is complicated to understand.
Use a Pivot Table. Doesn't give the exact layout you want, but is very simple to create and to update.
I'd suggest trying the Pivot Table using following steps:
Click on a cell in your data.
Insert > Table (using a table means the Pivot Table with automatically include all new lines added to your data)
Insert > Pivot Table and click OK
Add Trainer to Row Labels
Then Add Full Name to Row Labels
You can adjust layout if you want from the Pivot Table Tools > Design tab. I prefer changing Report Layout to "Show in Tabular Form" and changing Subtotals to "Do Not Show Subtotals"
After adding new rows to your table, right click on the Pivot Table and select Refresh.

Produce a subtotal using filtered data in a table in Excel

What I want to do is produce a subtotal using filtered data in a table, that doesn't change when I remove the filter from the table.
When I try using the 'subtotal' function, it produces the data I need, but as soon as I remove the filter from the table, the sum changes with the new cells added.
In short I want a subtotal from all 'x' entries in the table, even when the table itself is not showing the filtered data.
Is this possible?
please check this:
=SUBTOTAL(9;Table1[#All])
in the above example, have created a table which name is Table1 and I have tried the subtotal with the sum, I have checked with filters and without and works.

Resources