Null Validation in Excel Column - excel-2007

I need to create a template for internal data collection in MS Excel.
I need to make certain columns mandatory. I have a list of values associated with these columns.
I tried using Data Validation, but could not find any option which throws an error for null values.
How can I define data validation so that null value cannot be inserted in those columns?

Please provide more context.
Data validation fires when the user manually enters data into a cell. If a user does not even try to modify a specific cell, its data validation rule will never fire.
If data validation is based on a list and that list (for example defined by a named range) contains blanks, then any value can be entered, even blanks.
If you want to ensure that mandatory fields are filled in before the file can be saved, you need to add a Workbook_BeforeSave event to the workbook's ThisWorkbook module and check the respective cells for valid content.

Related

SSRS SQL report builder deleting column

I have a problem with SSRS report builder. Basically what I want to do is to delete a column. I have a report that someone else made and there is 1 column (xxx) that no longer exists in data source tables so I need to delete it.
When I go to query designer and delete this column from the code and run it there, it works. I close query designer window and see that list of columns (fields) is updated now and xxx column is not there. Then, I delete this column manually in designer (default screen) and when I try to run the report, It doesn't work:
"The Value expression for the text box ‘XXXDataField’ refers to the field ‘xxx’. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope. Letters in the names of fields must use the correct case."
But that field should be already deleted. So I don't know what else I can do, or what it can be linked to. I just want to delete it. Any Idea?
Thank you
If your dataset does not contain xxx but your DataTable has this error is normal
You either delete that column from your table or at lease delete DataSet Binding from table so that SSRS does not try to retrieve that column from DataSet
It will be a reference to the field in another field. For example, if you deleted a column that showed an OrderShipped status, then you might have another text box highlighted based on this.
The error is telling you which textbox is in error. So, click somewhere on the designer, then in the properties window, right at the top, click the dropdown which allows you to choose specific report items, choose XXXDataField (the one named in the error message) and then check the value expression. In there you will find the reference to the column you deleted.

Excel Named Range Formula - Not Automatic Updating

I have a table in Excel that has column heading names (e.g. data_type1, data_type2, etc.). The data in this table changes based on parameters entered on another sheet, and they are pulled to charts which update dynamically.
As a convenience to a user who might be using this sheet I have added a 'user specified function' (non-vba) which also plots to one of the charts. By user specified function I mean I have three cells with dropdown lists. Two correspond to the table headings and one has a short list of operations that can be applied between the two selected data types (e.g. a user might select 'dataype1', '+', 'datatype2' which would produce a sum of the two in the final column of my table).
The user specified function is achieved by defining a named 'range/function' to match the drop downs with their respective column headers and then calls evaluate. See below:
=EVALUATE("="&ADDRESS(ROW('Raw Data'!XFD5),MATCH(user_in1,'Raw Data'!$A$4:$AF$4,0)) & user_operation & ADDRESS(ROW('Raw Data'!XFD5),MATCH(user_in2,'Raw Data'!$A$4:$AF$4,0)))
I name this 'user1_result' and then enter =user1_result in the final column of my table. This approach is nice because it calculates much faster than doing the same thing through building a UDF in VBA and then applying that UDF to every cell in a fairly long column.
Now here is my hangup, this works fine initially, but if the user makes a parameter change that affects one or both of the selected datatypes, the user specified column does not recalculate on-the-fly with the updated data. If the user re-toggles any of the dropdowns the data does recalculate. I am speculating this is from one of two things:
1) Excel does not recognize that a precedent of 'user1_result' has changed, and so for efficiency sake doesn't bother to recompute the column;
2) The 'Evaluate' function used in the named definition of 'user1_result' is not checked for updating, because it's not a normal function (doesn't show up through intellisense if you try to just add that to a cell).
So I am looking for some either confirmation or refutation of these speculations. In the case of confirmation I am hoping to get some advice on how to force the user specified column to update if its precedents change.
One solution is to have VBA do this checking for me and force the computation, but I would like to leave that as a last resort. So, non-VBA solutions preferred.
For posterity I'll answer the above question based on Mat'sMug's feedback:
Regarding the cause of the problem:
The reason the user specified column does not update is because the 'Evaluate' portion of the 'user1_result' named formula is intended to be used at the application level and not as a worksheet function. Because of this, Excel doesn't bother checking to see if its precedents change and ignores it for recalculation.
The problem's solution:
It was suggested to use VBA to watch for worksheet_change events, however, my problem requires that I do NOT use VBA. So, an alternative workaround that forces Excel to check precedents and recalculate the user specified function uses two steps. This functions as a pseudo worksheet_change stand-in.
First, I use a helper cell that performs a countif with an arbitrary counting condition. I don't need it to change, I just need it to share precedents with the inputs of 'user1_result'. So I have it count the number of cells in the first row of data that are larger than some constant:
=COUNTIF(A5:AK5,">100000")
The result of this computation doesn't matter, but in my case my data have small values and so this returns 0 always.
Second, I use a condition for the computation in the user specified column (the last column in my data table).
=IF($AO$1=$AO$1,user1_result)
Now, anytime my data table updates, the final column using the named function recomputes. Simple, and if using macros is not viable (for example due to a client/user's security concerns), this can sort of substitute for a worksheet change event.
I hope somebody out there gets use from this!

MS Access: Reset input field in form to default value 0 upon exit form

EDIT: The fields shown in pictures below all have "value list" as row source type. The input in these fields are used in queries that pull data from tables as well, but these fields themselves do not use any tables.
I have a form in Access that requires users to provide input via listboxes, and then queries use that data to perform calculations.
However,when the entire access file is closed, the same input values are still in the listbox after reopening.
Ideally I want the values in the input fields to default to 0 (not null) as soon as the access file is closed (or re-opened), so when the user opens the database, he will see the value "0" in those fields. The reason to why I want the value 0 as default is because the inputboxes reflect possible commodities a product can contain, and I want to allow users to define the % commodity a product does or does not contain. 0 means the product does not contain that commodity and the user does not have to change the value in the listbox (more user friendly in my opinion). Picture illustration:
Hence each time I re-open the access file, I keep seeing those input values above, while I want them to be 0.
I did some research but don't really understand how to use the expression builder, and I can't find a way to make it work via a macro. I read something about the listboxes having to be 'bound', but I'm not entirely sure how to deal with this.
This is the above listboxes in design view:
You are using listboxes but at a height of one selection which is not the optimal use for such a form control as no multiple listing is shown at once together.
Consider using free-form textboxes with a default value of zero. But if you need to control a user's input, use combo boxes which defaults to the zero selection item. Most likely right now, each listbox is defaulting to its first selection item.
Here is how the Property Sheet / Data Tab of the combox would look (in fact Default Value might be redundant as zero is the first item):
Row Source : 0;20;40;60
Row Source Type: Value List
...
Default Value : 0
If combo boxes use a table/query row source, you will need to append a value of zero with a UNION query:
Row Source : SELECT TOP 1 0 AS ColName FROM TableName UNION SELECT Val FROM TableName;
Row Source Type: Table/Query
...
Default Value : 0

Drillthrough action not available after convert the pivot tables content to formulas

A Pivot table was build based on SSAS Multidimensional Cube. In the Cube a Drillthrough action was defined to show the documents details.
I converted only the content of the report from excel to formulas. This means the filters remains unchanged so the user can update the numbers only using the dropdown from filters.
The pivot table is listed below:
-> I observed that the Drillthrough action is not active anymore if you don't convert also the filters to formulas, just like below:
How can I enable the drillthrough action without to convert the filters to formulas?
I have noticed that if I have multiple items selected in the filter before converting to formulas the drillthrough actions are disabled. This means that the filter is a cubeset instead of a cubemember. I don't know why this is, but I think if you don't convert the filters, it treats them as cubesets regardless of if a single member is selected.
To get around this issue you could go ahead and convert the filter to formulas and then replace it with your own drop-down using data validation. For whatever attribute you want to filter, make a cubeset and then do cuberanked members.
Ex: In cell G2 I have =CUBESET("AWSSASMD","[Product].[Category].children","Categories")
In cell G3, I have: =IFERROR(CUBERANKEDMEMBER("AWSSASMD",$G$2,ROW()-2),""). I pull that formula down to 3 or four past the number of items I think I might have.
Then in cell B2 where I had the filter, I put a data validation.
Allow: list
Source: $G3:$G8
Then I can change my data validation drop-down, and my numbers change. And my drillthrough action is still available to me.
This works for me in Excel 2016.

Permissions in Excel

I have a sheet in Excel that has permissions set up to "Allow Users to Edit Ranges".
These different ranges consist of columns that users with different permissions can edit.
Is there any way to exclude cells/rows from these ranges?
For instance, I want to say I want the range of everything in column A except when cells in in column G of that row have nothing in them.
Alternatively, is there any way to use Macros to print out these complicated ranges?
You can select the cells with vba or manually and set the locked property to false before locking the sheet. This will allow the user to edit those range/cells.
You can use conditional formatting to identify these locked cells.
Select your range (ctrl-A for all the cells).
Conditional formatting
formula is: =CELL("protect",A1)=0
"Allow Users to Edit Ranges" only allows us to specify the range(s), not to apply a rule that would allow, or disallow, editing.
You could use Data Validation to produce an error message. For example, creating a Custom validation rule of
=K2<>""
in a particular cell would mean that an error message will be produced if they attempt to put a value into this other cell if K2 is empty. You need to uncheck the box which says Ignore Blank.
This is not foolproof though, as a Copy/Paste would wipe-out the rule.
It can be done with VBA, but even then it could be circumvented with Copy/Paste. However, the (for example) BeforeSave event could be used to check the content of these cells and produce a message and prevent the save.
Disclaimer: I don't know whether VBA works with a file that uses the "Allow Users to Edit Ranges" feature.