Ignoring Hidden Table Rows in Excel Formula - excel

Good Evening.
I am trying to get my formulas to ignore hidden rows in a filtered table. I have attempted some of the tricks shown here, but I haven't been successful.
The CSV I get from BigFix (network management tool) looks something like:
The applications column lists the applications in the same cell. As a result, when I do a count function to identify the issues, I have to use a wildcard (I'm searching for the results in a different tab).
=COUNTIF('Input Data'!C:C,"*"&Results!A2&"*")
I want to be able to filter the table on the first tab, and have the formula results show up accurately on the 2nd tab.
Any ideas?
UPDATE:
I feel more information would help. The reason I want the "results" tab to update automatically is that I plan to build graphs out of the information on that tab. I would love to be able to filter the table in the 'input data' to include only Department A and have the graph autoupdate to Department A's info.
The excel files I'm working with have up to a thousand entries, and I'm trying to get graphs I can copy/paste to put into a presentation as efficiently as possible.

=SUMPRODUCT(SUBTOTAL(3,OFFSET('Input Data'!C:C,ROW('Input Data'!C:C)-MIN(ROW('Input Data'!C:C)),,1))*(ISNUMBER(SEARCH(A2,'Input Data'!C:C))))
In the above formula Restrict the C:C to your actual data range or use a named range to identify the Actual Data Range.
Edit
Above formula should be replaced with 103 instead of 3 as pointed by Jeep
=SUMPRODUCT(SUBTOTAL(103,OFFSET('Input Data'!C:C,ROW('Input Data'!C:C)-MIN(ROW('Input Data'!C:C)),,1))*(ISNUMBER(SEARCH(A2,'Input Data'!C:C))))
In the above formula Restrict the C:C to your actual data range or use a named range to identify the Actual Data Range.
Adding Explanation based on OP's Request.
In the above formula Used Sumproduct() Subtotal() Offset() Min() Row() IsNumber() Search() function combinations for arriving your expected result.
Row() - Will get the Row Number of a given range
Min() - Will get the Minimum Value of a given Numbers
Offset() - Is used to redirect the reference to each cell of a given range.
Subtotal() - Is used to find the (un)hidden state of redirected reference.
Search() - Is used to find the specific text in a given range (Not case sensitive) will result Number or error.
IsNumber() Is Used to check whether search returns Number or error. So Isnumber will return boolean True/False as result.
Column-C Column-D
Data For Filtering
a 1
b 1
a 1
a 2
a 2
The above data starts from 1st Row with headers in the 1st Row. Assume that I filtered D column With 1. Using the below formula will result 2.
=SUMPRODUCT(SUBTOTAL(103,OFFSET('Input Data'!C2:C6,ROW('Input Data'!C2:C6)-MIN(ROW('Input Data'!C2:C6)),,1))*(ISNUMBER(SEARCH("a",'Input Data'!C2:C6))))
ROW('Input Data'!C2:C6) = {2;3;4;5;6}
MIN(ROW('Input Data'!C2:C6)) = 2
ROW('Input Data'!C2:C6)-MIN(ROW('Input Data'!C2:C6)) should be read as
{2;3;4;5;6}-2 = {0;1;2;3;4}
OFFSET('Input Data'!C2:C6,ROW('Input Data'!C2:C6)-MIN(ROW('Input Data'!C2:C6)),,1) = 'Input Data'!C2,'Input Data'!C3,'Input Data'!C4,'Input Data'!C5,'Input Data'!C6
SUBTOTAL(103,OFFSET('Input Data'!C2:C6,ROW('Input Data'!C2:C6)-MIN(ROW('Input Data'!C2:C6)),,1)) should be read as
SUBTOTAL(103,'Input Data'!C2,'Input Data'!C3,'Input Data'!C4,'Input Data'!C5,'Input Data'!C6) = {1;1;1;0;0}
Subtotal() arrived the visible state of each (cell) reference.
SEARCH("a",'Input Data'!C2:C6) = {1;#VALUE!;1;1;1}
ISNUMBER(SEARCH("a",'Input Data'!C2:C6)) should be read as
ISNUMBER({1;#VALUE!;1;1;1}) = {TRUE;FALSE;TRUE;TRUE;TRUE}
SUBTOTAL(103,OFFSET('Input Data'!C2:C6,ROW('Input Data'!C2:C6)-MIN(ROW('Input Data'!C2:C6)),,1)) = {1;1;1;0;0}
(ISNUMBER(SEARCH("a",'Input Data'!C2:C6))) = {TRUE;FALSE;TRUE;TRUE;TRUE}
{1;1;1;0;0}*{TRUE;FALSE;TRUE;TRUE;TRUE} = {1;0;1;0;0}
SUMPRODUCT({1;0;1;0;0}) = 2
Used Sumproduct() to avoid Array Entry and also to do the Array Formula Task (Looping through the range of cells) and Sumproduct() will result the Sum of the passed values.

Instead of filtering the source data, use the Countifs function and add the filter conditions to the Countifs.

Related

How would I return a partial string to a calculated column based on a look up table

I need to parse cell for partial string match equal to any of the items in the look up table and return the first match (It would also be nice if it can return multiple matches if there happened to be more than 1 country in the comma separated cell * not required as this would be rare and can be covered by Multi country if needed*)
=IFS(SEARCH(L3,[#Tags]),SEARCH(L4,[#Tags]),SEARCH(L5,[#Tags]),SEARCH(L6,[#Tags])) result in errors I've also tried it using nested IF statements . I've also tried find in place of search
See link for example of Data set : Link
You may benefit from SUMPRODUCT and INDEX:
Formula in column D is:
=INDEX($I$2:$I$5;SUMPRODUCT(COUNTIF(B2;"*"&$I$2:$I$5&"*")*ROW($I$2:$I$5))-1)
Because ROW returns the row number related to whole worksheet but data starts at row 2, you need to substract minus 1.
Also, if you have Excel 365, probably you can use advanced functions to return more than 1 entry.
See if the following works for you:
Formula in D2:
=LOOKUP(99^99,SEARCH(","&Table2[Countries]&",",","&[#Tags]&","),Table2[Countries])

Index Match Formula Shows Wrong Result

I have two table, this one is the initial table that contains raw data (on Sheet 2)
And the second table (on Sheet 1) contains formula based on data from first table
I use this formula to calculate the data, but as we can see on the picture, it doesn't produce right result. Could you please help me to modify the formula?
=IFERROR(INDEX(Sheet2!$E$2:$E$12,MATCH(Sheet1!$B$1&Sheet1!B$2&Sheet1!$A3,Sheet2!$C$2:$C$12&Sheet2!$B$2:$B$12&Sheet2!$D$2:$D$12,0)),"")
First the auxiliar column, using the concatenate operator & :
Then the formula would be:
=VLOOKUP(B$2&$E$1&$A3;Sheet2!$A:$G;6;0)
Change 6 for 7 if you want the description instead of Activity.
Please try this formula. It should go into cell Sheet1!B3 where it must be confirmed with Ctl+Shift+Enter because it's an array formula. (017)
=IFERROR(INDEX(Table,MATCH(1,(INDEX(Table,,3)=$A$1)*(INDEX(Table,,2)=B$2)*(INDEX(Table,,4)=$A3),0),5),"")
In preparation of this formula to work you need to set up a named range by the name of "Table" which comprises of Sheet2!A2:Fxx. Better set this range up dynamically so that it expands as you add more data but you can also declare it as Sheet2!A2:F1000 where 1000 is a number of rows you expect never to need.
This table has 6 columns, A:F which I intentionally made to include column A, which you don't need so that range columns and sheet columns are identical. Table,,3 simply defines the 3rd column. You can replace it with Sheet2!$C$2:$C$1000. If you do, make sure that all your ranges have identical sizes.
The 5 near the end of the formula, at ,0),5),"") identifies the 5th column of the range Table from which the result is returned if the 3 criteria match. Change this number to 6 to return the result from column F or to 1 if you ever need the value from column A.

SumIF Using Table/Named Range Instead of Single Cell Criteria

I have 2 sheets in a workbook (Sheet1, Sheet2).
Sheet 2 contains a table (Named Table1) with 5 columns:
Takeaways
Household
Clothing
Fuel
Groceries
On sheet one, I have 2 columns:
Expense Name
Expense Total
Now, what I am trying to do is:
Set the range for the Expense Name (Range 1)
Set the range for the Expense Total (Range 2)
Compare Range 1 with the respective column in the table and only add up the values for matches
For example, in Range 1 (B6:B16):
BP
Caltex
McDonalds
KFC
In Range 2 (C6:C16):
300
400
200
150
Now, all I want to do is add up the values for the Takeaways (McDonalds, KFC) and exclude anything that DOES NOT match the criteria.
So my sum total will be all occurrences of Takeaways - provided they are listed in my table - 350 in this case.
But I cannot seem to get the formula to work.
I used these sources:
https://exceljet.net/excel-functions/excel-sumifs-function
Selecting a Specific Column of a Named Range for the SUMIF Function
and ended up with this formula:
=SUMIF($B$6:$B$16;Table1[Takeaways];C6:C16)
This source:
https://excelchamps.com/blog/sumif-sumifs-or-logic/
and ended up with this formula:
=SUM(SUMIFS(C6:C16;B6:B16;Table1[Takeaways]))
Both formulae return 0.
BUT, with BOTH of them, if I change Table1[Takeaways] to "McDonalds", then it correctly identifies every occurrence of the word "McDonalds" in Range 1.
EDIT:
I have updated the formulae above to match the images below.
This is the table that contains the references:
This table contains the data:
Formula:
Cell C4 (Next to Takeaways): =SUMIF($B$6:B$16;Table1[Takeaways];C6:C16)
Cell C5 (Next to Fuel): =SUM(SUMIFS(C6:C16;B6:B16;Table1[Fuel]))
It appears that ONLY BP is being detected in the formula.
This is a an output table when I use the formulae with a single cell reference and not a table or used range:
Formula:
Cell F4 (Next to BP): =SUMIF($B$6:B$16;"BP";C6:C16)
Cell F5 (Next to Caltex): =SUM(SUMIFS(C6:C16;B6:B16;"Caltex"))
Cell F6 (Next to McDonalds): =SUMIF($B$6:B$16;"McDonalds";C6:C16)
Cell F7 (Next to KFC): =SUM(SUMIFS(C6:C16;B6:B16;"KFC"))
If I understand correctly what you're trying to achieve, I think your setup is not right conceptually.
It looks like you're trying to track expenses, and each expense (or payee) is allocated to a category ("Takeaways", "Household" etc.). From a relational-model point of view, your second table (which defines the category for each expense/payee) should only have two columns (or variables): Expense Name and Expense Category.
The table you set up ('Sheet 2') uses the categories (i.e., possible values) as different columns (i.e., variables). But there's only variable, namely the "Expense Category", and the categories themselves are the possible values.
If you set it up like that, the problem changes: you can add a dependent column to your first table that shows the category for each payee (or "Expense Name"), using a VLOOKUP() from the second table.
You can then sum the expenses for all payees matching that category.
Note: I've created the illustration using LibreOffice Calc, so there might be some small differences, but the logic is the same.
Without seeing the data in L and K I can't give you a full answer - but likely it's to do with the way you're pulling your Array
Try something similar to this
=SUMPRODUCT(SUMIFS($L$11:$L$43,$K$11:$K$43,CHOOSE({1,2},Takeaways,"anything else you wanted to sum")))
Remember SUMIFS is for multiple criteria, so if you're only calculating one, you'll need =SUMPRODUCT(SUMIF(
The way the above works is with vertical vectors only, but changing your named ranges so the table of 2 columns is 2 named ranges instead should be okay - unless it's part of your requirements
Table 2 would become expense_Name and expense_Total etc
I was about to close this as a duplicate of my own question here but there is a bit of a difference in using a named range I think. However the logic behind this follows more or less the same approach.
Working further on my partial solution below I derived the following formula:
=SUMPRODUCT(COUNTIF(Table1[Takeaways];Range1)*Range2)
The COUNTIF() part counts the number of occurrences of the cell value in your table. Therefore make sure there are no duplicates in your table. If the value is present in the table the result of COUNTIF() will be 0. This way we create a matrix of 1's and 0's. By multiplying and the use of SUMPRODUCT() we force excel to perform matrix calculations and return the correct result.
Partial solution
I used the following formula:
=SUMPRODUCT(ISNUMBER(MATCH(Range1;Table1[Takeaways]))*Range2)
The formula does the following:
The MATCH()checks if the value in Range1 is present in your table and returns the position of the matching value in your table.
The ISNUMBER() checks if a match is found by checking if the MATCH() fucntion returned a number
Multiplying this with Range2 forces matrix calculation, using the SUMPRODUCT() function
EDIT:
This worked for a really limited sample. As soon as I added the fourth row to my data the formula stopped working as intended. See screenshot:
It took the first two values into the sum correctly, the fourth is not taken into account.

Index Small and If in Excel for multiple criteria

Hi All I have been trying to use the formula below and to alter it for multiple conditions
{=INDEX($C$1:$C$51,SMALL(IF($A$1:$A$51="Adeline",ROW($A$1:$A$51),""),3),1)}
I have a table on sheet1 called Data and a page for calculations. There is a matching ID on both sheets though in the table on sheet1 an ID could be on multiple rows. Also the CODE column could contain in this case TEST2 multiple times for same ID but with different Values. I am trying to in this case find the 3rd value for this combination.
So I trying to find out a value based on ID and a column called Code but I would like the 3rd value
So I've tried altering the IF part of the statement
{=INDEX(Data[Value],SMALL(IF((Data[ID] =[#ID])*(Data[CODE] = "Test2") ,ROW($A$1:$A$51),""),3),1)}
and
{=INDEX(Data[Value],SMALL(IF((AND(Data[ID]=[#ID], Data[CODE] = "Test2") ,ROW($A$1:$A$51),""),3),1)}
Both Come up with errors - any advice or am I looking at this completely in the wrong way.
Sample Data
Calcs sheet
EDIT Change from Largest being the highest rank to Smallest being the highest rank
=IFERROR(AGGREGATE(15,6,1/(1/((Data[[ID]:[ID]]=Results[#[ID]:[ID]])*(Data[[Code]:[Code]]="Test 2")))*Data[[Value]:[Value]],COLUMNS($A:A)),"")
Notes:
We use multiplication of Booleans instead of an IF function
the 1/(1/(...)) formula part is a method of turning FALSE results from the Boolean multiplaction from 0 into a #DIV/0! error.
The AGGREGATE function provides a method of excluding the error results from the calculation.
Structured references have been changed to absolute references to allow dragging without changing the column names
The COLUMNS(... function will adjust to return {1,2,3] as you fill right to return the smallest; 2nd smallest, etc value
Note that with an absolute reference, the table name must be used even if the line is in the same table.

Excel - Check if value X and value Y is on the same row

I have an excel document with two sheets, data and edu-plan. The sheet data has the following information:
The sheet edu-plan looks like this:
My question is: how do i create an excel formula that checks if the target group on the specific row in edu-plan! has the course name in question on the same row as the target group in sheet data!, i.e. if Sales and Sales course is on the same row in the sheet data!?
In reality, the data sheet as a couple of hundred rows and will change over time, so i am trying to develop a formula that i can apply easily on all rows/columns in edu-plan!.
The desired result in edu-plan would look like this:
A pivot table might be a good way to go.
If you would like to do it by formula, then you can just use a COUNTIFS
=IF(COUNTIFS(data!$A$2:$A$10,$A2,data!$B$2:$B$10,B$1),"X","")
A possible way to solve your issue with an array formula:
Write in B2 of sheet edu-plan
{=IFERROR(IF(MATCH('edu-plan'!$A2&'edu-plan'!B$1,data!$A$2:$A$6&data!$B$2:$B$6,0)>0,"x",""),"")}
Since it is an array formula, you need to hit shift + ctr + enter.
Here is the formula broken down:
MATCH('edu-plan'!$A2&'edu-plan'!B$1,data!$A$2:$A$6&data!$B$2:$B$6,0)
checks whether the combination of row header and column header is in the data table. MATCH returns the index of the found combination. Since we are not interested in the location, we only ask IF(MATCH > 0, "x", "") to write an "x" if a match was found. If MATCH finds nothing, it returns an error, which is why we add an IFERROR(VALUE, "") around the construct.

Resources