Nov 17 2019 03:21 AM
Nov 17 2019 03:21 AM
I am using INDEX, SMALL, COUNTIF to extract records from a list with 10 columns and averages 200 rows. There's is a 2 text analysis code and a 3 text budget code, examples are AD, EQ, ST for analysis code and MAR, RUN for project code. The current code is:
=IFERROR(INDEX(AllData,SMALL(IF(COUNTIF($Q$40,**bleep**)*COUNTIF($Q$41,ProjectCode),ROW(TSB!$A$5:$T$119)-MIN(ROW(TSB!$A$5:$T$119))+1),ROW(A1)),COLUMN(A1)),"") (plus curly brackets.)
I want to search on more than one analysis code (Q40) so I thought I just needed to add another COUNTIF but realised as I was doing it that I was trying to use a 3 dimensional array, of course it didn't work. So I tried it on the Project Code with a COUNTIFS, see next, it worked over 3 inputs:
Aha, I thought, so I added a second criteria to the first COUNTIFS but that didn't work. Is it because I am trying to do a COUNTIFS twice on the same range? There could be up to 5 analysis codes to one project.
Ideally I would like to put up to 5 criteria in the first COUNTIFS and wildcards into the second. I really do get my nickers in a twist over &, " and '.
Example attached, thanks for any help.
Nov 17 2019 04:10 AM
It's an amazingly complicated formula. What exactly are you trying to achieve?
Have you considered putting a filter on your column headers? It seems you can get the same extract by just ticking the relevant check boxes in the column filters. E.g., you can select three Analysis codes, a Budget code and a Project code and then it will display all rows that match that filter. That's roughly what your formula is doing now for only one Analysis code.
Nov 17 2019 06:30 AM
I agree I can do that and have tried it out on the users who have knowledge of Excel ranging from nothing to nought! The users numbering 40 plus ring me up and tell me they are missing transactions and I ask them they can see little arrows at the top of the columns and they ask me 'what is a column'! Entering 3 cells is about all they can manage.
Nov 17 2019 06:37 AM
Re question 'what am I trying to achieve'. There are a number of projects of which each user is assigned a 'manager'. When they see how much their projects are costing they want to identify where and what they have spent the money on rather than trawling through hundreds of rows, 90% which they are not interested in. They want to input their project(s) and the type of purchase and get a list. I am going to add a column to the 'report' for each line as a percentage of the total budget so that they can immediately see where all the money has gone.
Nov 17 2019 07:13 AM
Have quite some experience with users who don't know much about Excel. Prefer to teach them some basics on how to use a fairly simple sheet, rather than designing a sheet that becomes complex and that would have to be fool-proof so that users can't screw it up. But that's your choice.
Nov 17 2019 08:18 AMSolution
If to extract by formulas records from list based on few criteria, I'd use AGGREGATE to avoid array formulas.
In this case
formula could be like
=IFERROR( INDEX(A$5:A$38, AGGREGATE( 15, 6, 1/(**bleep**=$O$10)/(Budget=$P$10)/(ProjectCode=$Q$10)* (ROW($A$5:$A$38)-ROW($A$4)), (ROW()-ROW($O$10)) ) ), "")
and in 1/()/().. part you may add as many criteria as needed.
Nov 18 2019 03:31 PM
Thank you, I've found a new best friend in AGGREGATE, just what I wanted.
If one of the criteria entered is blank can I force it to be true and list all codes in the range. We have one manager who needs to see all projects (PRO) by putting a blank in the project code (P5, P4 etc.).
As someone said in another forum - 'The best Excel function you're not using'
ps the bleep was because I used the word A N A L, short for Analysis!