Wildcard in Drop-down menu used in Array Formula - arrays

I have been searching the internet for hours! I have been working on an array index formula to search for multiple criteria and return multiple matches based on criteria in drop-down menu's. So, I have the following formula in cell E9 which searches cells E2,F2,G2,H2,I2 & J2 in the 'Summary' worksheet against their corresponding columns on the 'Main' worksheet.
=IFERROR(INDEX(Main!$E$3:$E$200,SMALL(IF(1=((--($E$2=Main!$A$2:$A$200))*(--($F$2<=Main!$C$2:$C$200))*(--($G$2>=Main!$D$2:$D$200))*(--($H$2=Main!$B$2:$B$200))*(--($I$2=Main!$H$2:$H$200))*(--($J$2=Main!$I$2:$I$200))),ROW(Main!$E$3:$E$200)-3,""),ROW()-8)),"")
Other formulas I have for SUMIF & COUNTIF allow the "*" to be selected in any of the drop-down lists to bypass that list, or 'select-all'. Is it possible to add something to the array formula to bypass that criterion if I want to 'select all'?
For example, in the images I've added Example 1 shows the Summary tab and Example 2 shows the Main tab. So, for the criteria I've chosen, what i want is to see a list in E9 downwards of all the journeys that 'Bob' has been on.
I would appreciate any advice.
Thanks very much.

You will need to put IFs inside for each criteria:
If($E$2 = "Select All",1,$E$2=Main!$A$2:$A$200)
so:
=IFERROR(INDEX(Main!$E$2:$E$200,
SMALL(
IF(If($E$2 = "Select All",1,$E$2=Main!$A$2:$A$200)*
If($F$2 = "Select All",1,$F$2<=Main!$C$2:$C$200)*
If($G$2 = "Select All",1,$G$2>=Main!$D$2:$D$200)*
If($H$2 = "Select All",1,$H$2=Main!$B$2:$B$200)*
If($I$2 = "Select All",1,$I$2=Main!$H$2:$H$200)*
If($J$2 = "Select All",1,$J$2=Main!$I$2:$I$200)
,ROW(Main!$E$2:$E$200)-1,"")
,ROW()-8)
),"")

Related

Using Filters to match and preventing incorrect data due to blank cells

I'm attempting to match data from two different sheets and bring in a list of company names from that matching row
A1:A1000 = List of Companies
E1:E5000 = List of Matchable IDs
C1 = Manually Input ID
The following macro works:
=IFERROR(FILTER('List Companies'!A1:A1000,'List Companies'!E1:E1000='ID Sheet'!C1),"")
However if C9 is blank it returns an incorrect list.
If I try and use the following:
=IF(ISBLANK('ID Sheet'!C1), "", IFERROR(FILTER('List Companies'!A1:A1000,'List Companies'!E1:E1000='ID Sheet'!C1),""))
It returns:
"~ERROR"
I'm sure I must be doing something wrong but I don't know what I am doing wrong... if anyone could point out my mistake I would greatly appreciate some help.
VLOOKUP it.
if C1 is manual input of ID then:
=IFNA(VLOOKUP('ID Sheet'!C1, {'List Companies'!E:E, 'List Companies'!A:A}, 2, 0))

Google Sheets Search from Database and insert into specific cell on edit

i need some help from someone who is more experience than me.
I've the following formula
=WENNFEHLER(SVERWEIS($B$3;$B6:C;{2};0))
and the following script
function copyIntoCell() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('C3').activate();
spreadsheet.getRange('A3').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
};
How is it possible to add the formula into the script and also make it "onEdit" when a name entered into B3 it should auto insert the number into C3 from B6:C when B3 match with the database.
Also is it possible to autocomplete when I enter a word into B3 it suggest me the names from the database with the word I tipped in? This one is not important but would be nice.
Here is the example
Thanks for any help and idea I can get to complete what I looking for.
Combine script and formula as following:
Check if the edit was performed in column B
Retrieve the active row
setFormula() to assign your formula to the active row in column C
If the entered name is not found in the database and the formula returns the error "#NAME?" - delete the formula again
function onEdit(e) {
//check if edit takes place in the second column (B)
if(e.range.getA1Notation() =="B3"){
//proceed
var spreadsheet = SpreadsheetApp.getActive();
var row = e.range.getRow();
var formula = "=IFERROR(VLOOKUP($B$3,$B6:C,{2},0))";
//set formula to active row in column C
var cell = spreadsheet.getActiveSheet().getRange(row, 3);
cell.setFormula(formula);
}
};

Populate a Multi-column Combobox with a 2D array on Access

I tried to follow this method:
ComboBox1.ColumnCount = 2
Dim Films(1 To 5, 1 To 2) As String
Dim i As Integer, j As Integer
Films(1, 1) = "Lord of the Rings"
Films(2, 1) = "Speed"
Films(3, 1) = "Star Wars"
Films(4, 1) = "The Godfather"
Films(5, 1) = "Pulp Fiction"
Films(1, 2) = "Adventure"
Films(2, 2) = "Action"
Films(3, 2) = "Sci-Fi"
Films(4, 2) = "Crime"
Films(5, 2) = "Drama"
ComboBox1.List = Films
source
But the .List property does not work on Access. Any ideas ?
As June7 said, use the ComboBox.AddItem() method in a loop. For your purposes, the ComboBox must not be bound to a data source: It's Row Source Type property should be set to "Value List". To add a multi-column string to a ComboBox row, use a semicolon to delimit the the columns. For example:
ComboBox1.AddItem (Films(1, 1) & ";" & Films(1, 2))
or
Dim rowStr As String
rowStr = Films(1, 1) & ";" & Films(1, 2)
ComboBox1.AddItem (rowStr)
AddItem() automatically appends the row to the end of the ComboBox's list, if you do not specify a row index parameter. For more info, see ComboBox.AddItem method at Office Dev Center.
Screenshot: VBA Demonstration Image
A "Form" in Access is not the same kind of element/object as a "UserForm" is in Excel where your "source" link points to (https://www.excel-easy.com/vba/examples/multicolumn-combo-box.html).
In Access it would be a good idea to get the information into your Combo Box (or List Box) from either a table or a query. You can of course code it with VBA, but then you might find yourself adding/editing a hole lot of VBA here and there, as in Access it all goes more naturally by using SQL and the database engine.
This is a larger topic, but basically you should probably have different tables for "Films" and for "Categories"
Table1:
Table2:
Then you should define the relationships since most likely there are different amount of films in your database than there are categories. Saying that we would like to avoid a situation that you would have to add another movie, let's say "Die hard" into your movie list. That would probably fall into the category "Action". In the database we do not want to repeat ourselves. Just we will, by ID, refer to categoryID by it's value.
So, having done that you need to create a form in Access. Create maybe a query that will get the values for you:
After this you can define the source for the combo e.g. by using wizard:
So this way you can maintain each of the lists separately in their own tables.
Here is the query that got created:
On the Data tab you can decide which bound column to use relative to datasource.
On the Format tab you can adjust the widths of the columns in your combobox. Use 0 length to hide a column.
This way no VBA code is needed.
If needed it is also possible to create or edit the queries with VBA but that is another story.
Hope this helps.

Ignore array item if it doesn't exist in slicer items (slicer filtering with array)

I have encountered a problem when filtering an OLAP based pivot table slicer with items from an array.
I have an Array consisting of machine numbers that are identical to slicer items captions, that looks like this:
machines = Array("Machine1", "Machine2", "Machine3" etc.. )
and I want to use this array to filter the slicer using:
ActiveWorkbook.SlicerCaches("MachinesSlicer").VisibleSlicerItemsList = Array(machines)
And it works fine until there is a machine number in array that is not visible in the slicer items (for example due to other slicers filtering, such as date etc).
Is there a way to bypass those items that cause the problem?
I've tried to create a new array, looping through the slicer items and comparing them to array items using:
For Each machName In machines
For Each si1 In sl1.SlicerItems
If si1.Caption = machName Then
TestArray = TestArray & Chr(34) & si1.Caption & Chr(34) & Chr(44)
End If
Next si1
Next machName
But what it does is it creates an array that has a single element that is a string looking like:
"Machine1", "Machine2", Machine3" ...etc
But I need these elements to be seperated in order to pass them into the VisibleSlicerItemList.
Maybe some of you will have any idea how to resolve this problem.
Any help will be appreciated, thanks!
Ignore my previous answer, blonde moment. You need an array of course.
You can create a dynamic array based on sl1.SlicerItems
Dim dynArr()
Dim i as Integer 'Long
Dim si1
For Each si1 In sl1.SlicerItems
i = i + 1
ReDim Preserve dynArr(1 To i)
dynArr(i) = si1.Caption
Next
Pozdrawiam kolege ;)

SSRS 2008:How to hide a table row (Conditionally) based on category field

I am new to Sql Server Reporting Services. I have created my following report.
I want to remove/hide rows of Brand Total whenever it does not exist in Brand list. Like in following picture i want to remove/hide "Ethnic Total" whereas "Ethnic" Brand does not exist in "Sample Store 1".
Similary i want to reomve/hide rows of "Outfitters Total" and "Junior Total" from Section Two whereas "Outfitters" and "Junior" don't exist in "Sample Store 2".
This is the structure of my report.
And following is the expression for Net Qty of a Single Brand total.
=Sum(IIf(Fields!Brand.Value = "Outfitters", Fields!Quantity.Value, Nothing))
What should i do?
What condition should i write in expression for Row Visibility?
Thanks in Advance for help.
i hope the below comments you are looking for.
Step 1: select that particular row (Outfitlers Total, Junior Total,Ethnic Total,Store Total)
One at a time and right click and select Row Visibility Option.
Step 2 :
A Dialog box appears with 3 options
1.Show
2.Hide
3. Show or hide based on expression
Select option 3 and copy the below expression in the Expression dialog box.
=iif((Sum(IIf(Fields!Brand.Value = "Outfitters", Fields!Quantity.Value, Nothing))) is nothing ,True,False)
i hope So this will be helpful.
=IIF(Fields!TotalRems.Value=0, True, False)
Replace TotalRems with your correct field name
You can do this way:
=IIF(Fields!YourField.Value like "YourValue",false,true)
Replace "YourField" with your own one and also change "YourValue" to whatever you need.
NB, " " or '' not treated as NOTHING,
For more explanation:
SSRS – Hide Rows in a Group based on a Value
another possibility for the hiding expression is, to use a text box reference. In place of "Textbox1" in the expression below, you can use the name of the text box, which is in the crossing of column "Net Qty" and row "Ethnic Total" (or one of the other total rows you mentioned)
=Iif(IsNothing(ReportItems!Textbox1.Value),True,False)

Resources