How to build a column using data from another table with contraints - database

I have a very-badly done Excel Database that I have to repair. To do that, I need to get specific data from a table and put it in another table, if certain cells in each rows equals cells from rows in the first table.
Here is a screenshot to explain what I need.
I tried with advanced filters but I can't get it to work.

I got an answer.
The trick here is to use a vertical search (=VLOOKUP(cell; tableToSearch; cellToSearchLocation) and IF conditionning.
Sadly, my example isn't valid because the cell we search (in "hey" column) is a in a column before the "ho" and "hi" columns.
If anyone has any questions about this solution, feel free to ask.

Related

Dynamic SQL SSRS and Dynamic Row Grouping

I have a dynamic SQL query that have dynamic column names. ( The resultset is then pushed into a tablix very similar to this setup(https://www.youtube.com/watch?v=BB9wvvkDY7Y ).It works fine. However, I need to establish a grouping on the row in SSRS. Due to the dynamic nature, the fieldname is not available before run time and therefore I cannot set a group on the row. I have tried several workarounds, using parameters like :
=JOIN(Parameters!DynamicGroup.Value, ", ")
(it is a multivalued field), but I cannot seem to get this working. At best, I get 1 row returned.
I may not be clear on this, but what I need is to be able to use the grouping when exporting to excel to have each group create a new sheet in the workbook.
Any help would be appreciated.
Thanks for the replies. I figured out what why I am only getting back a single row. It is because of the way the dynamic query is pivoting the resultset and then grouping it to display all columns(marked with number) as a row. So all fields with the same number becomes a row. When I add another grouping it is taking this qrouping, hence there will only be one row because it is unique(pivoted).
This leads me to think that I cannot get this done this way. Is there a way that I can have dynamic column names (based on Dates)? There will always be the same number of columns returned, but the content will different. I googled this, but I have not found anything that really solves this issue.

Can I Fix the a lookup field in Access database based upon a calculation or another field?

I am trying to create a database with field descriptions for a very large excel file that I have at work. I have created 3 tables- List of sheets, list of variables(including a lookup field pointing at the List of sheets table, so that I can select the sheet to which the variable belongs), and a third table which specify some validation rule.
In this third table, I want to see two lookup fields, one specifying the sheet in which the rule applies(say, 'Select Sheet'), and another specifying the variable(say, 'Select Variable'). I can point to the two different tables, but I want to do something a bit more nuanced than that. When I give a particular sheet name to 'Select Sheet', I want the lookup field for the variable('Select Variable') to show me only those variables which exists in that sheet.
I know that there probably will be solutions using forms, but this database is going to be very detailed and there are things to do afterwards, so I do not want to get into queries and forms before all data has been recorded in tables in a neat manner.
I have a good grasp of VBA in the context of excel and I am given to understand that I can extend the applications of Access using VBA. I am ready to do that, but I want to see before that whether this is some functionality of access that I am missing. Had anyone done anything similar before, and if so, did it take VBA to do it?

Writing array to filtered and grouped table fails

I am having trouble writing an array defined in VBA to a range in a table that has been grouped and filtered.
Writing an array to a table range is done using:
Sheets(1).ListObjects(1).ListRows(1).Range = MyArray
This works fine on a filtered table (i.e. filtering the rows using the filter buttons in the row headers). It also works fine in a grouped table (i.e. with some columns grouped using Data --> Outline --> Group.
However, when combining this, the array is not written to the cells in a correct manner. An array [1,2,3,4,5,6,7,8] is written as [1,2,3,1,2,3,4,5], if I group columns 2 and 3 in the table. This is NOT the case, if I haven't also filtered the table.
Do anyone have an idea what's going on here? An example workbook can be found here. It contains a simple table and one sub that tries to write an array to the table.
Any help would be greatly appreciated!
BR
Torben
OK, so I have figured out a workaround/verification that this is a bug in Excel. If you select a cell outside the table range before inserting the array, it works fine - even when both filtering and grouping is active. Why this is the case, I have no idea. It's a clumsy solution (I'm not fond of selecting cells through VBA), but it works.
(Sorry, I originaly posted it as a comment, and not an answer).
If anyone has a more elegant solution, I would still be very interested in seeing it.

Excel dynamic offset table with results criteria

I am looking for a way to make a dynamically updated table in excel using a linked data source with filtered results.
What I currently have is a form control scrollbar that is linked to a random cell. That random cell drives an offset function (below) to pull results from the linked data table in another worksheet. All of this works wonderful but I am looking to strip out rows that meet a certain criteria, which I already have calculating to a true/false result in the table itself to make it simple. What I cannot figure out is how to modify my current offset lookup to filter out the results that are false in my calculated column.
=OFFSET(Sheet1!$C2,$I$99,0,1,1)
Sheet1 is where the linked data table is located.
$I$99 is where the cell link for my scrollbar is.
As the scrollbar moves the value in the cell link changes thus updating the offset lookup down the table. I should also state there are 14 rows in my table as well. I will need to filter out the false results but also in turn omit the blank rows as there are over 400 rows in the source table and only about 30 true results in the calculated column.
I unfortunately cannot provide the workbook I am using as it has company sensitive data in it but if it is absolutely needed I can create a filler document with made up data to provide something to work with.
I have looked at advanced filters already and they will not do the trick as they are not dynamic in nature. I would like a non VBA solution as this is a dashboard project that I will be distributing to my team here at work and macros are disabled on our network for security reasons every time an excel is opened so it will become a nuisance.
Let me know if you all need anything else from me.
Figured it out with a little help from a friend, coded each cell to function as an array part and it works like a charm.
{=IFERROR(INDEX(Dashboard_Data[Summary],SMALL(IF(LEFT(Dashboard_Data[Stale],1)="T",IF(Dashboard_Data[Visible],ROW(Dashboard_Data[Visible])-1,""),""),ROW(A1)+$K$18)),"")}

Hide row of data in matrix by field value

I need to know how to code this. I am working with program numbers and there is one that I do not want to be displayed. I am trying:
=Fields!NoProg.Value="08007"
But then I do not know how to tell it:
(pseudocode)
if NoProg = 08007, then do not display.
As I see it, you have two options:
Filter out the row you don't want in your resulting dataset at the database side. This has the advantage of using indexes if you have them set up. This involves putting a WHERE clause into your query. If you cannot change the query or need the row to be in the resulting dataset but simply hidden, choose this option.
SELECT ...
FROM ...
WHERE NoProg <> '08007'
Hide the row in the report, as you are already doing. This has the advantage of keeping the data in the resulting dataset but hiding it from that section of the report. If you are performing aggregation and need to include the row elsewhere but just hide the detail from view, choose this option. Keep in mind, this will not use any database indexes, so it requires one comparison for every row in the resulting dataset.
<Hidden>=Fields!NoProg.Value="08007"</Hidden>

Resources