Excel advanced filter not showing results - excel

Trying to put an advanced filter on an imported data list and copy to new sheet.
It only seems to either show everything in results or nothing except headers. I'm sure this is to do with my criteria, but I have tried every permutation I can think of (short of using VBA as I'm not competent with it), but nothing seems to yield actionable results.
If someone could have a look at the screenshots below and provide some direction I'd be most grateful.
The headers for the criteria are directly copied from the table headers and I've tried by separating the OR formulas into descending cells in the same column. Maybe it's to do with the syntax of the formulas I'm using, but I was informed by multiple sources online to have a formula that always returns a Boolean result and to have it tied to the first data in the worksheet that I want sorted (hence the B2, K2, O2, etc.).
Teylyn:
I was using this format for the criteria before, but it gave the same results - nothing at all!
criteria 2
Just tried again with the above criteria and no results again.
Additionally have tried with the following criteria - same again.
criteria 3
I need it to filter for every permutation of criteria columns 1, 2 & 3, hence the OR formulas being used before - I thought it might be filtering for AND all first row criteria, OR, AND all second row criteria.
I've even gone so far as to format all criteria such that it searches for first column (B2<=TODAY()-3) AND 2nd column AND 3rd column (O2="Not booked") then underneath, to imply OR, 1st column (B2<=TODAY()-3) AND 2nd column AND 3rd column (O2="Sent"). Setting out each permutation in this tiresome fashion. Still no results.
I can send you a dropbox link to the file if it will help.

You are not using Advanced filter correctly. It does not work with formulas like the ones you enter. You put one condition per cell, not a formula with OR().
Take a look at the documentation:
https://support.office.com/en-us/article/filter-by-using-advanced-criteria-4c9222fe-8529-4cd7-a898-3f16abdff32b#bkmk_5
or here:
https://www.techrepublic.com/blog/microsoft-office/how-to-use-and-and-or-operators-with-excels-advanced-filter/

Related

Excel: =COUNTIF or =COUNTIFS referencing a range as their criteria

I have used a macro to get me a list of around 600,000 files (hosted on a server) that are then listed into an Excel sheet. From this list, I need to know how many DON'T meet a certain criteria and I have a few different statistics being calculated based on the files and their types (PNG, JPG, .DOC, PDF, etc). What I'm calculating or excluding from this list is changing often depending on what data I'm analyzing from this list. So that I don't have to constantly update a formula with a list of exclusions from this list, I'm trying to write a function that will just exclude a list in another column.
My current solution is a simple =COUNTIFS(A:A,{"<>","<>JPEG File","<>Outlook File", etc}). The "<>" is there because it keeps counting blank cells after the list if it is not included. I want to actually replace the COUNTIFS criteria part with a list of items in another column. I tried =COUNTIF(A:A,"<>"&C:C) and this doesn't work, but is returning a value equivalent to COUNTA, not actually excluding the items in the C column that I add (I think it's function in an AND capacity for the criteria and not as an OR). I tried doing a =COUNTA(A:A)-COUNTIF(A:A, C:C) but again, COUNTIF seems to be counting C:C as a list of AND criteria and not ORs.
The ideal would be if this actually worked: =COUNTIFS(A:A, "<>", A:A, "<>C:C") except that COUNTIFS doesn't allow a range as a criteria, so this obviously can't work.
Is there another solution that I'm just not seeing? Knowing myself, I wouldn't be surprised if it was actually super obvious and something I should have seen or I'm just misunderstanding something here.
=SUMPRODUCT(--(ISNA(MATCH(A:A,C:C,0))))-COUNTIF(A:A,"")
Where A:A is dataset and C:C is list to exclude. Example:

How to extract whole rows of data in Excel if it contains a subtring within a string

The entire workbook is a few sheets long, however essentially I'm working with a base sheet that has around 8000 or so lines data with about 10 columns or so. The end goal of this project is to be able to input a start date, end date and a keyword and then be filtered one last time with another keyword. So far, I've been able to filter down the original data within the date range and within the first keyword. The problem arises now when the keyword is within a block of text that varies and is never quite the same. For example, one row contains
12T Q1FY23 Unscheduled/Emergency Maintenance
While another row contains
12T Q4FY23 ERT Spill Stations
There are hundreds of variations of this, but there, including ones that don't start with "12T". The starting data is subject to change so I can't quite use tables in excel and filter it that way, as once you apply a filter then the table won't update if new data is input as the source data, unless there is a way to do this and I just don't know how. So ultimately, I need the same filter that can be used on a table that says "contains" and/or "does not contain" as formulas. Formulas seem to work well with this dynamically/subject-to-change source data, so I'd like to keep it with formulas, as I have done with the filtering previously with the date range and then with the other keyword. The difference between what I want now and what I did for that other keyword is that it was a static keyword that isn't embedded within a string like the "12T". Please let me know if this is too vague or if there's any more material needed to help answer this question. Attached is a sample image of a what I'm working with on the original sheet. I'd like to be able to extract the rows containing only "12T", and not the one's "12T-M", for example, using only a formula. Assume that the data starts at A3 and ends at C8. I should also mention, just to be completely clear, I'm trying to copy these rows dynamically into another sheet so that it can be nicely viewed with only the relevant information and data.
To be extra clear, I first filter it the original data with the following formula:
=INDEX(Sheet1!$A$6:$N$6796, SMALL(IF(COUNTIF('12T'!$H$11,Sheet1!$G$6:$G$6796), MATCH(ROW(Sheet1!$A$6:$N$6796),ROW(Sheet1!$A$6:$N$6796)), ""), ROWS(B3:$B$3)), COLUMNS(Sheet1!$A$6:A6))
The "Sheet1" referral contains the original data and "12T" refers to the sheet that contains the filtering keywords (the dates and the number keyword). This formula extracts all of the rows of the original dataset in Sheet1 that contain a specific keyword, in this case its "5351 - Facilities: Maintenance: Building". These extracted rows of data are deposited as an array (Entered with ctrl+shift+enter) in a new sheet labeled "Xtract".
In this same sheet, I then filter out this array with the date range in mind. With the starting and ending date, I first calculate the number of instances that a date falls within the date range with the following formula.
=SUMPRODUCT(($A$2:$A$671>=Q2)*($A$2:$A$671<=Q3))
I use this result in the following formula in conjunction with the filtered data (filtered with the previous keyword) to filter it further so that I only get the rows of data that have their date in the date range.
=FILTER(A2:O671,(A2:A671>=Q2)*(A2:A671<=Q3),"No data")
This is also entered as an array, and is also in the "Xtract" sheet. With this filtered data set, I want to filter it one last time, so that only the rows of data that contain, for example, "12T" or "728M" in one of the cells (in which the respective cell can be written as "12T Q1FY23 UEM") can get extracted and placed into a final array. All of this is automatically updated simply by entering the values in this section I have shown below.
I can't use a table to filter the data, at least not that I know of, because if I filter a table by this logic ("contains '12T'" and "does not contain '-M'" to get only rows that contain 12T but not 12T-M or anything that's not 12T) then once I change the date range or the other keyword, the table won't update properly. If there's anything else I can add to help clarify, please let me know.
Add a column to the left containing formulae: "=find("12T ",B1) and copy down.
Note the space after T.
Rows matching that will have 1; rows not matching will have #VALUE! so you can sort on them.
P.S. if #VALUE! is ugly, you can use =NOT(ISERROR(FIND("12T ",B2)))
After a lot of searching and referencing my old work/internet, I found the formula to answer my problem. I understand this might not be the most clear since I can't quite provide the excel workbook I'm working with, but the goal of this was to automate all of the filtering so that no matter if data is added or not, when you change the filters, it will stay updated correctly. From the filtered data that I had already worked with, all I had to do to put it into another sheet was use the following formula:
=FILTER(XtractFilters!T2:AF900,ISNUMBER(SEARCH("12T *",XtractFilters!T2:T900)))
This finds all of the data containing a specific substring, which in this case specifically was "12T ", denoting the space as well. So all of the filtered results are then filtered once again so that only the rows where "12T " was found get returned. The range is just the entire range of data and then the column is the one containing the text where "12T " could be found.

Can these formulas be simplified? Why does INDIRECT function seem to not work inside an ISBLANK test within a MATCH formula?

Summary
I need an array formula that takes a row of data of certain length from Sheet1. For that row, in each column that is not blank, I need to grab the Sheet1 header value for that column and display that data in a continuous row on Sheet2 (without any spaces in between the row's cells).
Background
I have a table of data (employees and industry certifications with expiration date being the table's cell data) on sheet 1, with a row for each employee the spreadsheet is tracking. The certifications are the columns.
We are using this information to link to ID Badge Printer software (Bodno Silver), where we are limited to linking columns of data to a particular textbox.
The problem lies in the fact that not everyone has every certification. The rows are peppered with blanks separating the certifications that each employee does have. While setting up the required text boxes in the badge software template, that each link to a specific column, I quickly realized that since not everyone has every certification if we used the data how it was we would have a bunch of strange looking blanks in between the listed certifications rather than a continuous list.
What I did
My solution to this (which I'm open to a better one if anyone knows of one, other than "use better software"), was to create a new sheet and array formulas that no one would use except for me and the id printer software. This sheet would have a similar data table that took the rows of data interspersed with blank cells between expiration dates, and put the matching column headers for cells that had a date in them into a continuous row of the same maximum length (eliminating the blank cells).
Essentially, this would allow me to circumvent the restrictions of the badge software and each textbox would be MatchedCert1, MatchedCert2, MatchedCert3, etc. up to the original maximum number of certifications.
Pictures are probably better than my words at explaining what I am going for:
Sheet1 (source)
Sheet2 (result)
The array formulas
I worked on this one for a while. What I thought would be a simple INDEX, MATCH, ISBLANK formula (that I could create using the appropriate relative and absolute cell linking) and then expand to the whole sheet turned into a witch hunt and me praying for forgiveness for my sins to all that may be holy. Also a lot of googling.... I realized quickly that this one may not be so simple after all.
Finally, I arrived at the following two array formulas in order to correctly show what I was going for:
First Column of training section
{=IFERROR(INDEX(Sheet1!$E$2:$P3,1,MATCH(FALSE,ISBLANK(Sheet1!E3:Q3),0)),"")}
(easy enough, right? I thought so...)
I felt good about this until I tried to think through what would be required to get the formula to be universal so that I could use it on the entire table.
I feel dirty just putting the following in public, but here goes...
Second column through last column array formula
{=IFNA(INDEX(INDIRECT(ADDRESS(ROW($E$2),(MATCH(E3,Sheet1!$2:$2,0)+1),1,1, "Sheet1")&":"&ADDRESS(ROW(E3),COLUMN($Q3),1)),1,MATCH(FALSE, ISBLANK(INDEX(INDIRECT("Sheet1!"&ADDRESS(ROW(E3),(MATCH(E3,Sheet1!$2:$2,0)+1),1)&":"&ADDRESS(ROW(E3),COLUMN($Q3),1)),0,0)), 0)),"")}
(please don't call the police...)
[ninja edit] While this array formula works for 2nd result column through the final column, it doesn't work if there's not a blank column following the result range. The actual spreadsheet has 4 different groups of certifications that run horizontally, but I was able to just add a blank column in the corresponding data from the other sheet easily enough, so I just let it go. I'd give somebody a nickle for the answer to why that's the case here too [/edit]
Results
The first array formula, and INDEX MATCH using ISBLANK is rather straightforward.
The biggest question for me here, and the thing that drove me absolutely nuts for a couple of days, is why the second array formula requires the additional INDEX function nested inside of the ISBLANK function.
While taking the function apart and experimenting I realized that if I have any INDIRECT reference inside a ISBLANK function, which is itself inside of a MATCH function, the result of the match was ALWAYS 1:
{=MATCH(FALSE,ISBLANK(INDIRECT("$E3:$Q3")), 0)}
The above ALWAYS returns 1, whereas if I put the range in explicitly, the function would work just fine. That wasn't an option for me, since I needed to dynamically return the starting position for the match using the previous cell's address.
However, adding an INDEX function (with a column and row value of 0) to encapsulate the INDIRECT function provides the correct answer. I figured this out just by trial and error.
Questions
Can someone with more knowledge please let me know what is causing this behavior?
As a broader question, given I am limited to using formulas (no VBA), I would also like to know if I'm going about this in the wrong way or if there is a much simpler way of accomplishing this without this behemoth of a formula?
I know this sheet will probably require maintenance in a year - good luck future self!
Put this in E3, Copy over and down
=IFERROR(INDEX(Sheet1!$2:$2,AGGREGATE(15,6,COLUMN(INDEX($E:$P,MATCH($C3,Sheet1!$C:$C,0),0))/(INDEX(Sheet1!$E:$P,MATCH($C3,Sheet1!$C:$C,0),0)<>""),COLUMN(A:A))),"")
As to why your formula is not working, it is too convoluted to parse. One note, unless the sheets is the variable, one should avoid INDIRECT as much as possible. INDEX can almost always be used in its place.
Both INDIRECT and ADDRESS are volatile functions. Volatile functions will re-calculate every time Excel re-calculates, leading to a lot of unnecessary computations.
Not a solution but to answer why you are seeing this behavior:
EDIT: PREVIOUS EXPLANATION WAS JUST PLAIN WRONG
This confused me so, I did a bit of investigation:
I think that your problem is actually coming from the ISBLANK function because it is intended to be used with single values, and cannot handle ranges. Any BLANKs which are returned by functions are only converted to numeric values (0), when the BLANK is returned to (or displayed on) the sheet. If the function is returning to another function, the BLANK value seems to be preserved.
EDIT: ADDING A SOLUTION WITHOUT ARRAY FORMULAS
This is probably more complex than using an array formula... but I strongly dislike them, so do all I can to remove them.
Firstly, I would add an index to your positions in the results sheet:
=IF(F$7>COUNTIFS($F3:$L3,"<>"),
"",
IF(
MINIFS(
$F$7:$L$7,$F$7:$L$7,
">" & IFNA(INDEX($F$7:$L$7,MATCH(E9,$F$2:$L$2,0)),0),
$F3:$L3,
"<>"
)=0,
"",
INDEX(
$F$2:$L$2,
MATCH(
MINIFS(
$F$7:$L$7,$F$7:$L$7,
">" & IFNA(INDEX($F$7:$L$7,MATCH(E9,$F$2:$L$2,0)),0),
$F3:$L3,
"<>"
),
$F$7:$L$7,
0
)
)
)
)
Basically, the formula looks at the cert in the previous cell, and looks for the next, minimum index, greater than that.

Print the results of a vlookup to a cell in excel

I have been working on a solution to this problem for a few hours now and I am basically no where except knowing that I don't know how to do it...So here goes.
I want to take the original data that I have in Excel that have 'code#s' for each 'category#'. With those 'code#s', I can look up the 'category#' name.
This has been so challenging because there are a varying number of categories for every 'title#'.
I have tried printing the 'category#' name next to 'title#', but it is seemingly impossible because Excel goes through every row in the original data and gives a True, False or #N/A instead of selecting and printing only the true statements without copying down a thousand rows. I want it to go through all the possibilities and only select the categories based on the criteria that they have the same 'title#' and their lookup code matches somewhere in the lookup table.
Thanks if you can offer any sort of help.
Here are some of the formulas I have tried:
IF(AND($M$5=TOP_TREND_CONTRIBUTORS!$W$2:$W$253,MATCH(TOP_TREND_CONTRIBUTORS!$A$2:$A$253,'Category Lookup'!$D$3:$D$30,0)<>"#N/A"),TOP_TREND_CONTRIBUTORS!$A$2:$A$253,FALSE)
....where M5, W:W is the 'title#', A:A is the code for the lookup-in that part I am trying to say that they are valid if the code registers in the lookup table and the 'title#s' are equal. The last part I am trying to get it to print the 'code#s' that are valid. But that only works when I drag the formula down all the rows.
Maybe I'm missing something, but I just tried to get from your original data and lookup table to the final result. I used VLOOKUP to put categories next to titles and then used pivot table to present the data in the way you wanted (after changing some settings of pivot table and fields). Is that what you need? (some words are in Polish, it doesn't matter).

Excel Record Matching Two Sheets

Can't seem to figure this out.
I have two Excel sheets, A and B.
Sheet A has a column full of MLS IDs, call this column M and Sheet B has a column full of MLS IDs call this column N.
I would like to search Sheet A for the values from column N in the second sheet and where there is a match I would like to add a column O.
I have tried using VLOOKUP but afraid my formula doesn't work too well, and the extension .
Any help is appreciated.
If vlookup is failing, I would investigate using the index match method instead - it's very well documented online, and sidesteps most of the failings of lookups very nicely and efficiently. This link might help: http://www.mbaexcel.com/excel/why-index-match-is-better-than-vlookup/
There's a breakdown of how to use VLOOKUP here:
How to combine two excels that have a common column (but aren't in the same order)
A few common issues:
- Make sure the exact search string is actually in the search range (no leading whitespace, etc.)
- The search range needs to be anchored or it will drift and you will lose results
- the 4th argument (exact match) should be FALSE or you might get weird behavior

Resources