How to filter multiple values - excel

In the image down below I have an example.
There are 2 columns with name Clientnumber. What I need is that the values under Clientnumber1 are filtered from Clientnumber and are Printed in a third sheet. In this example the filtered values are printed under the column Filtered. So the sales are included. Does anyone know how to do this?

What you need is advanced filter. Activate the third sheet - the one where you want the filtered data. Then select advanced filter (Data - Advanced [next to filter]) Select: Copy to another location. Select the table you want to filter as list range. Select the values you want to get as a criteria range (note that you'll have to change the title of the criteria column to match the title of the column in the table - from Clientnumber1 to Clientnumber in your case. Finally for copy to you select a cell in the third sheet.

Related

How pass dynamic value to a INDEX function in Excel?

I want to write a dynamic excel condition to fetch some values based on the cell Contents.
My excel sheet contain 3 tabs. Home, tab_1 and tab_2 respectively. In the home tab, I have some text contents for selecting sheet and table.
In the tab_1 sheet, i have tables named as Table_1, Table_2,Table_3 and Table_4.
Now I want to get some elements from the table based on the text values.
Example: if the sheet name = Tab_1 and Table name = Table_1 then i will take the 2nd index values from Table_1 array in Tab_1 sheet.
My plan is to do dynamically using excel formula.
So i have tried to write the below logic to get 2nd index values.
INDEX(INDIRECT("'"&$B$2& "'!B1:F1"),2)
here it will take $B2 as Tab_1 . I am passing table value as "B1:F1".
Now i don't know how to get the matching array (instead of B1:F1) with the cell $B3 in the home sheet (Table_1).
Any suggestion or help ?
Finally after some research, I found the solution. We can use MATCH function to check the exact row name.
INDIRECT("'"&$B$2&"'!A1:F4)
This will search in the next tab (cell B2 text name ie: Tab_1 and table from A1 to F4 cells)
MATCH($B2,INDIRECT("'"&$B$2&"'!A1:F4),0)
This will search the exact name (from cell B3 text ie: Table_1) from the tab
So All together you can write below function:
INDEX(INDIRECT("'"&$B$2&"'!A1:F4),MATCH($B3,INDIRECT("'"&$B$2&"'!A1:F4),0),2)
I hope this solution will help you someone who facing for this kind of problems.

Excel CountIf with Multiple Nested If Statements

I have a table of Data in Excel on one tab that I have created a report for on another tab. The Report is a table filled with calculations which are fed from the data tab. Right now all results are shown for the week ending date I select. I am now trying to add code to the formula calculations that allows me to further progressively filter the table results.
For example From:
"All" Default Data for selected Week Ending
-->Filter by column F in data tab
--> Filter by column F & G, but if F is blank show all values in column F and filter only on G
--> Filter by column F, G and H, but if F or G is blank filter only on column G- and for any combination of blanks and selected values there should be.
I have the extra filters set up as drop down selections from the data validation tab and the lists are all in a 3rd tab away from the report and master data. I have 8 columns right now that I am trying to be able to filter on in any combination.
This is an example of the code I started with for the filter:
(1) =IF($Q$4="",COUNTIFS(Master!A:A,B$2),COUNTIFS(Master!$A:$A,B$2,Master!B:B,$Q$4))
(2)=IF($Q$5="",COUNTIFS(Master!$A:$A,B$2),COUNTIFS(Master!$A:$A,B$2,Master!C:C,$Q$5))
Breakdown of Formula 1 (same concept for the remaining):
Q4 refers to the cell that the dropdown list resides for this particular filter
Master!A:A is the master data file
B2 is the Date being searched for in the Master Data
Master!B:B is the column to be filtered by the Q4 selection
So far when trying to combine two or more of the Q selections (there are several, Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11 which filters columns B:B,C:C,D:D,E:E and so on in the master data. I need the table formulas to be able to handle receiving input from the dropdown and progressively filter down the data for each selection, or allow all data from that column (not already filtered out) to pass through to the next criteria.
So far when I try to combine the Q dropdown formulas I end up with a value of 0, since even if I have a
countifs(if(OR(Q2="", Q3="") followed by the filter criteria
if one of the filters is not selected, the formula drops the total value to "0" when it gets to the blank in the Q criteria.
Someone please help! Is there another way to do this? I feel like I am so close and am just missing something small.
TIA,
Jesse
So something like this:
=COUNTIFS(Master!$A:$A,B$2,Master!B:B,IF($Q$4<>"",$Q$4,"*"),Master!c:C,IF($Q$5<>"",$Q$5,"*"),...)

Data validation (Drop down) to auto-populate column with formula

I'm trying to make an excel sheet a lot smaller and easier to handle. What i'm trying to do is have a drop down auto-populate a whole column.
My original sheet looks like:
Item Name(A1) Item Code(B1) Price1(C1) Price2(D1) Price3(E1) Price4(F1)
My goal is to look like:
Item Name(A1) Item Code(B1) Price Drop Down(C1)
I also want to be able to delete an item in Column A and still be able to have the correct values. My VLOOKUP only uses 1 column and wont change (of course) when I switch to a different price set.
You could try something like this:
Copy your original table to another sheet (sheet2), so you can use it as the lookup table. In the original sheet delete the last 4 columns (C:F). Next create a dropdownmenu in cell C1, with items {price1 ,price2 ,price3 ,price4}. Put the following formula in cell C2 and copy down.
=VLOOKUP(A2,Sheet2!A:F,RIGHT($C$1,1)+2,FALSE)
The last parameter [FALSE] is necessary when the item names in the lookuptable are not in alphabetical order.

Count of distinct values with several criteria

I want to be able to count distinct values with several criteria. As presented here below on the screenshot, I would like to know, how many POs do I have per month depending on the PO type (service or material).
Initial data:
Desired result:
All the data is in text format.The difficulty is that the initial data table will be updated every month (I will be adding lines), so the formula has to consider possible updates. Pivot table will not work for me.
The solution I'm offering involves one helper column, but you'll be able to use it quite flexibly. I make the following assumptions:
You can add columns to your original table
The table starts in cell A1
Steps:
Convert your data range into a dynamic excel table (select the range, press Ctrl+t, tick "Table Has Headers" - you get a blue table as a result). This way if you add more data, formulas will drag themselves down.
type "HELPER" into cell D1, and "Number of POs" into cell E1 - this will create 2 new columns (they should turn blue like the rest of table)
paste this formula into cell D2:
=[#[Month/Year]]&[#[Mate/Serv]]
Paste this formula into cell E2:
=SUMPRODUCT(
( [HELPER]=[#[Month/Year]] & [#[Mate/Serv]] ) /
COUNTIFS([Month/Year],[Month/Year],
[Mate/Serv],[Mate/Serv],
[PO No.],[PO No.]
)
)
Add a pivot table, put Number of POs into values area, it will sum values by default.
As in this picture:
Right-click inside the values area, select Summarise Values By.. => MAX (as in second picture below).
You will see that values in pivot have changed.
this way you won't have to manually maintain the header in your summary table as pivot table will pick up any new entries/months.
IF YOU WANT TO STICK TO YOUR ORIGINAL DESIGN:
The same formula can be used (with minor change to add table name to column names), but it still needs the table and helper - follow steps 1-3. Make sure you're set up is as in picture below:
=SUMPRODUCT(
( Table2[HELPER]=H$1&$G2 ) /
COUNTIFS(Table2[Month/Year],Table2[Month/Year],
Table2[Mate/Serv],Table2[Mate/Serv],
Table2[PO No.],Table2[PO No.]
)
)
If anyone would like to change my formula to avoid creating a helper, please do.
I created a dummy table so your results won't be like mine.
How to test:
Copy your data on a new sheet
Go to Data menu ribbon => Remove Duplicates
Pivot the remainder
Put met/serve into rows, month/year into columns, Helper into Values.
That will give you a count you should expect.
Assuming your data is in Columns J:L, you can add a helper column in M, entering this formula in M2 and dragging down:
=COUNTIF(J:J,J2)
Then, assuming your desired result table is in columns N:P enter this formula in O2:
=COUNTIFS($K:$K,O$1,$L:$L,$N2,$M:$M,">0")-MAX((COUNTIFS($K:$K,O$1,$L:$L,$N2,$M:$M,">1")-1),0)
You can then drag this cell over to column P and drag them both down.
This also assumes you Desired result table headers are formatted as text as well.

Associating a cell outside a pivot table with one within it - excel

I'm currently creating a Pivot table in excel with several filters which read in rows.
What I need to do is associate a cell that sits outside of the pivot table, with the row of content within the pivot table. So that whenever a filter is applied within the pivot table the content outside it behaves in the same way.
I don't want the values/text within the cells to change - just to follow the behaviour of the filtered content in the table.
I've tried to add this 'outside' info to the pivot table but it just makes it over complicated.
Please can anyone help? Is this even possible?
hard to answer without knowing exactly what you're trying to do however using the GETPIVOTDATA formula may achieve your desired result
(https://support.office.com/en-gb/article/GETPIVOTDATA-function-026db7b1-dd6f-4057-9396-2c2798d159db)
=GETPIVOTDATA("Value",$B$9,"Row Label","Row Value")
"Value" = the name of the field you want to return a result for
$B$9 = location of any cell in the pivot table
"Row Label" (optional, repeatable) = field that you want to filter by from row labels (if left blank will return grand total)
"Row Value" = value of filter applied to Row Label, can be a formula e.g. if row labels are in column B and you want the filter to relate to whichever value is on row 10 you can use B10
changing the values in your report filter will edit the result of this formula

Resources