Formula based on a specific part of data date - vba

I am looking to have a countifs formula count based on the time provided as part of a date. I do not want to manipulate the raw data i just want to ignore the whole number of a date, I need the decimal place to determine if it is greater or less that .6667.
=COUNTIFS(DATA!$C:$C,">="&$A$1,DATA!$C:$C,"<="&$L$1,DATA!$V:$V,"<.6667",DATA!$E:$E,5)
DATA SOURCE: https://docs.google.com/spreadsheets/d/1uGexXFJ-vIngyzjNXJOVhsO_iFfn3E21XojCjwrhH2g/edit?usp=sharing
Desired result will return a the count if UTC time is greater than or less than .6667 (4:00:00 pm(local)). This will allow me to determine if the reviews are atributed to the Lunch or Dinner shift.

To to determine if the reviews are attributed to the Lunch or Dinner shift, your interest should be in time only. So you may safely ignore the date part and thus the DATA!$C:$C,">="&$A$1,DATA!$C:$C,"<="&$L$1 part in your formula.
Basically what is left with are just 2 criteria:
Overall Rating = 5
Submission Time < 0.6667.
That being said, let's try to get the desired solution step-by-step (you may find it extra descriptive, it's just to make sure we are on the same page):
Change column C (Submission Date Time (UTC)) from Text to Date & time format. This can easily be done by omitting "- ". Select the whole column, press Ctrl + H. In the "Find what" field, type "-", leave the "Replace with" field blank, and click "Replace all" button.
Since you are using column V for the <.6667 criteria, put the formula =C2-INT(C2) in row 2 of that column, then copy and populate rest of the rows. This'll get us the time only - that's what we are looking for.
Finally, get the desired result by using the formula:
=COUNTIFS(data!$V:$V,"<.6667",data!$E:$E,5)

Related

Summing the value of the aggregate function Last()

enter image description hereI am trying to design a report in ssrs that returns the last opening stock for each product in the dataset. To achieve this I used
=Last(Fields!CustProdAdj_new_openingstockValue.Value).
This works fine. But where I encountered a problem is in getting the sum of all the opening stock for each product. I tried using
=sum(Last(Fields!CustProdAdj_new_openingstockValue.Value))
but I got the error message
[Error on Preview]
Please is there another way to go about this
I have tried using aggregate(), runningValue(), to no avail
This is the dataset
This is the report layout
On previewing having used max()
This is probably easier to do directly in the dataset query but assuming you cannot change that, then this should work...
This assumes your data is ordered by the CustProdAdj_createdon column and that this is a date, datetime or some other ordered value, change this bit if required.
=SUM(
IIF(Fields!CustProdAdj_createdon.Value = Max(Fields!CustProdAdj_createdon.Value, "MyRowGroupNameHere"),
CustProdAdj_new_openingstockValue,
0)
)
Change the MyRowGroupNameHere to be the name of the rowgroup spelled exactly as it is in the rowgroup panel below the main design panel. Case sensitive and include quotes.
What this does is, for each row within the rowgroup "MyRowGroupNameHere", compare the CustProdAdj_createdon date to the max CustProdAdj_createdon across the rowgroup. . If it is the same then return the CustProdAdj_new_openingstockValue else return 0.
This will return the value required on only 1 record within the group.
For example, if you had 1 row per day then only on the last day of the month would a value be returned other than 0 because only the date of the last record would match the maximum date within the group.
Then it simply sums the results of this up.

SQL query - How to achieve the subsequent column updation by summing up the value of current row in Single select query (need to avoid while loop)

The logic which we are trying to achieve in single query is as follows.
We need to loop based on row number column. So, on each loop we need to sum-up remaining value and new value.. resultant value to be updated in "by summing up column". and the decimal part to be updated in decimal value column.
in next step, need to sum-up the decimal value column by grouping on row number. and the resultant to be updated in remaining value column of next row number
the above step 1-2 to be continued till we reach last record.
We achieved this through while loop.. But trying to achieve this without while loop.
Can someone please give idea to achieve this
Please refer the attached image for understanding table
enter image description here

Minimum of dates selection in Access

I have a date clause for the selection of my data. There are two date fields on my form 'oberflache' which are start and end. I want to choose the minimum of two fields. i.e it should only choose the record based on the date which comes first.Here is the code am trying with.
PARAMETERS [Forms]![oberflache]![start] DateTime, [Forms]![oberflache]![end] DateTime;
SELECT Lau.AN, Lau.Ve, Lau.Du, Lau.Sta, Lau.A, Lau.B, Lau.SW, Lau.Po
FROM Laufzettel
WHERE
Min(Fix(Lau.A)) Between Forms![oberflache]!start And Forms![oberflache]!end))
Or
Min(Fix(Lau.B)) Between Forms![oberflache]!start And Forms![oberflache]!end;
Where AN,Ve,Du,Sta,A,B,SW,Po are the fields from the table Lau. So the cases are
Lau.A Lau.B
1.11.2016 5.11.2016
2.11.2016 3.11.2016
20.10.2016 4.11.2016
4.11.2016 28.10.2016
Here when I give the start and end Dates as 1.11.2016 and
4.11.2016. I want the records to be selected in such a way that if the date of Lau.A or Lau.B is before 1.11.2016 just like in the 3rd record or 4th record they must be left out and the first two are selected.
With the code I tried
It gives me an error that cannot have aggregate function in WHERE clause. What is an alternative for the above?

Set Analysis - Current year and previous financial periods

Trying to get the below code to run correctly, I want to get the sum of the field movement where the field GlYear is the same as what has been selected and the field GlPeriod is less than or equal to the period selected.
sum({$ <GlYear = {"{'1'} =$(=max(GlYear))"}, GlPeriod = {"{'1'} <=$(=max(GlPeriod))"}>}Movement)
I can't convert the two fields to dates as there are 16 financial periods within a year to be reviewed.
sum({$ <GlYear = {"$(=max(GlYear))"}, GlPeriod = {"<=$(=max(GlPeriod))"}>}Movement)
I'm not sure what you are trying to achieve with the {'1'}
My expression gives me this based on some quick test data
Tip it usually helps me figure out the set analysis by leaving the expression without a caption so that I can see the results of the $() expansion

Transpose into new columns; Excel

I could use some help in inventorying some online purchases.
I would like the information in column A to be separated into the following:
Vendor name; item description; eBay item #; purchase price; shipping cost; purchase date
example:
ldean747; MEN'S WILLIAM BAY" "; 260725743398; 10.50; 0.00; 01/28/11
I'm getting hung up because some of the products do not have shipping cost (which would be the second dollar amount you see in the picture).
Any easy way to do this rather than going through and copy paste, transpose on each purchase?
You have a couple of challenges here
dynamic data set format: 3 text fields followed by 1 or 2 numeric fields (vertically)
multiple field seperators / delimiters across your data set
1st field: '()''
2nd field: '|'
3rd field: ':'
You could now start to create formulas which extract the relevant parts of each field using functions like =LEFT(), =MID(), =RIGHT(), =SEARCH(), etc. which for some cases (3rd field) is pretty straightforward, for others can get a bit complex ...
Concretely - the fields can be identified as following:
if the cell above is numeric AND I am alpha THEN I am 1st field
if the cell above is 1st field THEN I am 2nd field
if the cell above is 2nd field THEN I am 3rd field
if the cell above is 3rd field THEN I am product cost
if the cell above is numeric AND I am numeric THEN I am shipping cost
numeric / alpha: =TYPE(), extracting substrings seperated by seperation characters is well covered here at SO
Alternatively you could start to write a VBA program that does the same job for you
meta code:
loop through all rows
determine record type
process record type
So give it a try and come back with more questions.