Calculating dates in excel - date

I want to count the dates. 1 date = 1, 2 dates = 2...
I have 2 dates and I want to prepare a formula if I have 2 dates, then this is total 2.

Adjust the range references to suit your data.
=COUNTA(C2:G2)
Where C2:G2 is your first row under datum. This equation will count the number of non blank cells.
If 4.9. is a number an not text, then you could also use
=COUNT(C2:G2)

In Excel you could create a new column that checks if the cell is a date by doing =ISERROR(DAY(A1)).
If it is a date the formula will return FALSE.
Then simply count all the cells with FALSE by doing =COUNTIF(B1:B10;FALSE)
Here B1:B10 should be replaced with the cellrange of your new column that holds the true or false values

Related

How to convert logical columns to double in MATLAB table

For my task I need to convert all logical columns in a table to double. The table is sorted so I want to keep the order of columns.
Here is a mini example:
SomeString={'one';'two';'three'}
SomeNumbers={1;2;3}
SomeLogicals=[true; false; true]
T=table(SomeString, SomeNumbers, SomeLogicals)
T(:,vartype('logical'))=cell2table(cellfun(#double,table2cell(T(:,vartype('logical'))),'uniformOutput',false))
Why are the columns still logical?
T(:,vartype('logical'))
3×1 table
SomeLogicals
________
true
false
true
And how can I convert them?
Based on your reply to my comment, this should do what you want
logicalColumns = T.Properties.VariableNames(cellfun(#(x) islogical(T.(x)), T.Properties.VariableNames));
for c = 1:length(logicalColumns)
T.(logicalColumns{c}) = double(T.(logicalColumns{c}));
end
Here we get the names of the columns which contain logical values and then iterate over these columns setting them to double values of 1 or 0 for true and false.

Match if date is within date range google sheets

I have two columns with a start (column B) and end (column C) date range, and a cell (G1) with a date.
I want to be able to look at columns B and C and return true if G1 falls in between any of the date range of B and C, and if G1 is not within the date, return false.
Any suggestions on how to do this?
You can use the following formula
=IFERROR(IF(
QUERY(L2:M14,"WHERE L <= DATE '"&TEXT(K2, "yyyy-mm-dd")&"'
AND M >= DATE '"&TEXT(K2, "yyyy-mm-dd")&"'")
>0,TRUE),FALSE)
(Please adjust ranges to your needs)
Functions used:
QUERY
Assuming this formula is used on row 2, this will work:
=ISBETWEEN($G$1,$B2,$C2)
Change $B2 and $C2 appropriately if you're not on row 2.
Note that the ISBETWEEN() function has two additional optional boolean parameters to control whether the start/end dates are inclusive or exclusive for the range; both default to TRUE for inclusive endpoints.

MATLAB drop observations from a timetable not contained in another timetable

I have two timetables, each of them have 4 columns, where the first 2 columns are of my particular interest. The first column is a date and the second is an hour.
How can I know which observations (by date an hour) are in the timetable 1 but not in the timetable 2 and, therefore, drop those observations from my timetable 1?
So for example, just by looking I realized that timetable1 included the day 25/05/2015 with hours 1 and 2, but the timetable 2 did not include them, therefore I would like to drop those observations from timetable 1.
I tried using the command groups_timetable1 = findgroups(timetable1.Date,timetable1.Hour);but unfortunately this command does not tell you a lot how to distinguish between observations.
Thank you!
call ismember to find one set of data in another.
to find multiple records as a group in another composite records, you call ismember(..., 'rows').
for example
baseline=[
100, 2.1
200, 7.5
120, 11.0
];
isin=ismember(baseline,[200, 7.5],'rows');
pos=find(isin)
if you have time date strings or datetime objects, please convert those to numerical values, such as by calling datenum or posixtime first.
You can use the timetable method innerjoin to do this. Like so:
% Fabricate some data
dates1 = datetime(2015, 5, ones(10,1));
hours1 = (1:10)';
timetable1 = timetable(dates1(:), hours1, rand(10,1), rand(10,1), ...
'VariableNames', {'Hour', 'Price', 'Volume'});
% Subselect a few rows for timetable2
timetable2 = timetable1([1:3, 6:10],:);
% Use innerjoin to pick rows where Time & Hour intersect:
innerjoin(timetable1, timetable2, 'Keys', {'Time', 'Hour'})
By default, the result of innerjoin contains the table variables from both input tables - that may or may not be what you want.

How to display total sum values in summary band of groups partial sums

I have a report like the image below:
Note that the sections separated by a blank space are grouped by the month and are iterated over a group band. I want to put partial in the summary band by the type of the register, like in the example figure get the sum for Register type A in January = 10, February = 5, March = 1 so as the total = 10 + 5 + 1 = 16. So the summary will look like:
How can I achieve that kind of conditional sum in jasper? Thanks in advance.
After trying a little bit with iReport I found a solution: to get the partial sum by type you have to add a variable that has the calculation type as "sum" and the reset type set as "Report". Once you set the values you have to create a variable Expression that has value only when the cell value of type is the desired value, so for the example in the question, in the column Value of the summary band in cell with the value "16" you have the expression :
$F{type}.equals("A") ? $F{value} : 0
and so on for the other types in the summary.

SSRS - Expression to count the number of dates in a colums

In SSRS,how to count the number of dates present in a column?
I am developing a report where I need to display the total number of dates where Date_of_Delivery.Value is updated in a specific month & also I need to display the same for where Date_of_Delivery.Value is Not updated.
Please insist me.
If you want a count of the number of times a date is in a certain time period, you would use the IFF to perform the check and then SUM the results.
=SUM(IIF(Fields!Date_of_Delivery.Value >= CDATE("01/01/2016") AND Fields!Date_of_Delivery.Value <= CDATE("01/31/2016"), 1, 0)
The IFF will check to see if the Date of Delivery is between two dates and return 1 if true otherwise 0. The SUM then sums up all the results.
You should probably use some Parameters for your date so you can just change the parameters instead of the code in the report.
=SUM(IIF(Fields!Date_of_Delivery.Value >= Parameters!START_DATE.Value AND Fields!Date_of_Delivery.Value <= Parameters!END_DATE.Value, 1, 0)