Ms access conditional sum - ms-access

Please assist... to get to the point can Ms access conditional sum like Ms excel.
e.g
SUMIF(range,criteria,[sum_range]) \ SUMIF(O2:AJ6,"<>99",Sheet4!A1:V1)
So the range is the number of columns for a record and the [sum_range] is a reference.
Can this equation be achieved with Ms Access
Can this be done for multiple field?
i have created an ms access database for Quality department that has questions, weights and options.
The problem is that... the assessor will capture details of the call using three options (Yes, No and N/A) Yes = different weights (1,2,4,or 10), No = 0 and N/A = 99. With that being said i need to calculate the total assessment sheet score based on the yes, no and exclude the not applicable questions. the assessment sheet has 24 question with different weights.
The total assessment score is 100 and depended on the N/A options selected, the weight of the assessment will decrease and bring about a new total based on the yes and no that were selected.
Is this possible on access?

I think you need to get a good book or tutorial about how a database like Access works. It is obvious that you come from the spreadsheet world and you will have a hard time if you don't wrap your head around the basics of databases and the differences to Excel.
To answer your question:
You just need a query where you add conditions (or a WHERE-Clause in the SQL view).
Example:
SELECT SUM(Fieldname) FROM Tablename WHERE Fieldname2="xy"

The answer that i was looking for is IIF statement
Solution below
2: IIf([Q2]='Yes',1,IIf([Q2]='No',0))
For the question that i have i can convert to be a specific number and then can i have all the results and create calculation.

Related

New to Access: How do I obtain the standard deviations for grouped data in MS Access?

I have data on hundreds of horse races. I am trying to Clean and prepare the data for Machine Learning analysis, and I need to transform certain Speed Ratings into Standard Deviation Scores around the Means for each individual race or group of scores.
So, each race is a Group of Scores.
My data look somewhat like this:
And I am trying to get here:
Is there an easy way to calculate those Stats WITHIN groups,
as opposed to for the entire population of data?
Can they be automatically entered into the three columns to the Right of the SPD figures?
Thanks for any assistance you are able to offer.
Following indication a) from the comment that has been posted, the next Query provides the result that you want:
SELECT aggregs.Race, Spd, AVE, SD, Spd-AVE AS STD
FROM
(SELECT Race, Avg(Spd) AS AVE, StdevP(Spd) AS SD
FROM tblRaces
GROUP BY Race) AS Aggregs
INNER JOIN
tblRaces
ON Aggregs.Race = tblRaces.Race
I have used the expression "Spd-AVE" to calculate the values of field STD, although you did not indicate which formula you want. Therefore, you should replace "Spd-AVE" by the specific expression that you want.
If you want to get more familiar with aggregation, you may check the Queries F_Select_w_group_by_aggreg, F_Select_w_group_by_aggreg_Syn, F_Select_w_total_aggreg and F_Select_w_total_aggreg_Syn from the database of examples downloadable from LightningGuide.net.
Note that I am using the function StdevP() because I guess you are handling the total population of data. If it is just a sample, you should rather use Stdev().

SPSS changing count totals

I am running crosstabs from a survey in SPSS - Layered 2 independent variables on one question (the dependent variable). There are 1000 responses total, but whenever I run the crosstab it returns the data with 1001 or 999 or 1002 responses total. I have tried using both the Custom Tables feature and the Descriptive Crosstab feature. Neither will give me the correct totals, and all of the counts are just barely off. Is this a common problem? How do I fix it? Thanks in advance.

If Else Statement in Access Table Field

I'm super confused how to apply the if/else statement in an Access table field, not a query. Please help! Here is what I'm required to do based on the table I constructed:
Fill in the overall rating field, using this formula: If the is available field is false, the overall rating is “pending”, regardless of the scores. Otherwise, if each rating score is 9 or above, the rating is ''excellent"; if the interview average is 9 or above and one rating score is less than 9, the rating is ''very good"; if the interview average is less than 9 and one (or both) rating score is 8 or above, the rating is "erratic"; otherwise the rating is "reject".
click here to view the table
From Access 2010 onward you can indeed create calculated fields in a table. To do that, open the table in Design View, enter the name for the new column and choose Calculated as its data type.
Use the Expression Builder or any external text editor to build/write the expression for the calculated field. There is only a limited subset of functions available to be used in a calculated table field. So in this case the Expression Builder actually is helpful, as it shows only functions that can be used in this context.
To achieve the result as per your requirements, you will need an expression with several nested Iif-Function calls. (The Switch function is not available here.)
The actual expression will be same as you would use in a query.
This is how you can do it, if you really want to. – I agree with the commenters that in almost any case it would be better to use a query to do any calculation of this kind.

DBGrid - how to show the differnce between a column value in two adjacent rows as another column?

Let's say I record my car's latitude & longitude every minute or so, adding a row to a table each time.
I want to have a DB grid with 4 columns
latitude
longitude
distance since last measurment
curent street address, if known
Number 4, I can try to retrieve from Google Maps and I either get a text or blank, so let's ignore that.
How do I get #3? Should I calculate it in my application or in MySql (using a stored procedure or just a complicated SELECT)?
Whichever answer, can someone provide some sample code, or a link to an example? Google is not my friend today :-(
You can do it either way:
Calculate it in your query, and display it in a calculated column (such as when showing line totals where you're displaying ITEM_PRICE, QUANTITY, ITEM_PRICE * QUANTITY AS LINE_COST.
Calculate it in your application, using a calculated field (double-click the TTable component to open the Fields Editor, add field, set the type to ftCalculated, and write code in the OnCalcEvent for that calculated field.
The first choice is usually preferable, because the DB is usually more efficient at doing those sorts of thing on sets of data than when your code does it by row instead. (Set operations are obviously more efficient than row operations.)
Ken’s answer is goes far as it goes, because the most difficult task of solving your problem is getting data from two rows at the same time in SQL. If you were using Oracle or SQL Server, you could use the analytical/windowing LAG function. With MySQL you have to do it yourself. Here are 2 articles on how to simulate LAG in MySQL
http://www.onlamp.com/pub/a/mysql/2007/03/29/emulating-analytic-aka-ranking-functions-with-mysql.html?page=1
http://explainextended.com/2009/03/12/analytic-functions-optimizing-lag-lead-first_value-last_value/
Plus there are StackOverflow questions on how to get data from the previous row.
How do I lag columns in MySQL?
Calculate delta(difference of current and previous row) in sql
I cannot offer any opinion on any of them because I seldom work with MySQL.

Fetching a value of a text box in a matrix report in SSRS

I am working with a matrix report in ssrs.
Here is a sample screenshot of my report extracted in excel
The report is simple enough. It shows the data for different years (example : AS OF JAN,2012).
The netrevenue for the years are defined in the database so they are fetched accordingly. The problem is with the other sub columns. Like the "%Change" column.
The column value is calculated with the help of following formula
%change = ((NetRevenue of The current year / NetRevenue of the last year) - 1) * 100
Now what I doing to solve this problem is calculate the values using sql queries for every column and then binding it directly to the control.
My question is that is there a simpler way to do this. I mean like in table control I can access the value of a cell by using
ReportItems!Textbox1.Value
Is there a way I can access the dynamic columns of the matrix report. Like accessing the netRevenue values for different years.
If more clarification is needed for the question then please ask.
Thanks in advance.
I believe the only issue your going to have is getting the revenue at the past year?
In this case you'll need to calculate the last years revenue in the sql. Then use:
=((RpItems!NetRev.Value / RpItems!NetRev_LastYr.Value) - 1) * 100
With this case you'll need to calculate all the last years values for the % changes you want to calculate.
Can I suggest you look into this and raise another question with the sql you currently have?
I've found this works best.