Hi Everyone,
I am new to Spotfire so if someone could point me to the right direction, that would be great.
I have a request ID (primary key) that has various statuses and would like to find the difference in time for some specific statuses (say, request submitted vs request approved). Along with that, I want to take the non-working day (weekends off) from the calculation (if request was submitted on Friday and approved on next Monday, then the difference should be just 1 day rather than 3).
My data table is structured as below:
Any help/direction will be much appreciated!
Thank you,
Update
The output I am expecting would be something like below. For the ID. 101, the submission date is April 26 and Approval date is May 1st, so we are taking off weekends from the calculation and similarly for ID 103, the request was completed on weekends so time spend was 0 whereas for 102, we calculated the total time elapsed weekdays.
There are two parts of the problem:
1. match dates from different rows
Insert a new calculation column ([date approved])
Max(If([Payment_status_code]="STS_APPROVED",[CREATE_TIMESTAMP],null)) OVER ([PAYMENT_REQUEST_ID])
This will add approved date to each row.
2. calculate number of working days
(I've just copied formula between # from here, replace column names as appropriate)
If([Payment_status_code]="STS_RECEIVED",#if(dayofyear([START DATE])=dayofyear([END DATE]),0,(Integer(DateDiff("day",[START DATE],[END DATE]) / 7) * 5) + DayOfWeek([END DATE]) - DayOfWeek([START DATE]) + (if((DayOfWeek([END DATE]) - DayOfWeek([START DATE]))<0,5,0)))#,null)
Related
I'm trying to develop a formula in MS Excel that will give me the number of occurrences a task will happen in a year (or month), based on a start date, frequency and schedule in a table. I am looking to produce a table like the following (assuming the start date is 01/01/YR1):
I'm open to VBA suggestions also.
The minimum frequency is completing the task every week. Not taking into account daily tasks here. The data is held in a table. I calculated the 'times per year' using :
=IF([#Schedule]="Months",(12/[#Frequency]), IF([#Schedule]="Weeks",(52/[#Frequency]),IF([#Schedule]="Years",1/[#Frequency],0)))
I may look to take this onto a monthly schedule also, i.e. number of occurrences for each month across 5 years. It would also be useful to specify an overall end date for when the tasks would stop. (e.g. sometimes it would be year 3, sometimes year 5)
Your help is much appreciated!
=IF(D$2=1,ROUND(D$2*$C3-0.45,0),ROUND(D$2*$C3-0.45,0)-SUM($D3:OFFSET($C3,0,D$2-1)))
The formula is dragable so just place it in D3 then drag across then down. Also note the change in format of the table so the year numbers are usable in the calculations.
Note: I would suggest that the value the 5th year of the 2.5 year frequency is incorrect.
In the 3rd year you would do it and have a half year remaining. Then add that to years 4 & 5 and you get 2.5 time to do it again.
I have the following table
Payments left is calculated by matching the first occurrence of value zero and returning the index of that row (I am subtracting 2 because first payment is on row 2).
This works now because first payment is on June 1, 2020 but If I open this spreadsheet 3 months from now it will still say payments left 15. That will not be correct anymore since at that time 3 payments are made so should say payment left 12.
Is there any way to dynamically know at what row should the calculation of "Payments left" start.
With other words if today is August 15 2020 (I can manually enter today's date if needed), then calculating Payments left should start from September 1, 2020 until the end.
After playing a little bit around I was able to accomplish that with this formula:
where Last Payment Sent is: =DATE(YEAR(TODAY()),MONTH(TODAY()),1)
DATEDIF() function returns the time period between 2 to dates in the units specified.
You can keep today's day in one cell with the TODAY() function, and sum in your formula
the index of the table plus the months elapsed since the last payment.
Pesudocode example would be:
your formula + DATEDIF(LastpaymentCellAddress; TODAY()StoredCellAddress, "m")
The third argument "m" is to return the time elapsed in months.
https://support.office.com/en-us/article/calculate-the-difference-between-two-dates-8235e7c9-b430-44ca-9425-46100a162f38
Take into account that the dates in the arguments must follow an order fo the function to work, and the smaller date goes first. It is time from-to function.
Hope that helps
This should do the trick:
=COUNTIFS($A:$A,">"&TODAY())
Hi I have a problem developing formula to calculate following logic in Excel. I need to identify patients visits within 30 days interval and then within the identified 30 days interval the most latest date for prescribed medication.
lets say patients first visit was on 18Dec2018, this should count as New visit. so all visits until 18Jan2019 are considired as within 30days visits. This calculation I have solved nicely with this formula.
=OM(OCH(ELLER(C3=C2;C3=C4);ANTAL.OM(C:C;C3)>1;ANTAL.OM(C$2:C3;C3)>1;DAGAR(A3;A2)<30;DAGAR(A3;A4)<30;DAGAR(A:A;A3)<30);"Within 30dgr";"New Visit")
And I get in Kolumn G.
No I however within period 18Dec to 18 Jan need to identify latest date for Recepee Registered Date which is available in Kolumn F and I got stack which formula even to start with trying.
For the first part of your problem, there is a small error in your formula - the last row should not be New Visit since the difference is less than 30.
To keep things understandable, I have created 1 extra column as described below:
Date Difference from latest new entry: this will be
a. 0 if - first entry of patient ;
b. difference between row's date - previous new entry date
c. reset when the difference exceeds 30 - for ex: in row 5 the diff > 30 thus in row 6 it gets reset and the difference is calculated between row6 and row5 instead of row6 and row1
Unique Visit: marks whether the visit is new or within 30 days
Formula for date difference(put in row 1):
=IF(D2<>D1,0,IF(I1="New",B2-B1,B2-B1+H1))
Formula for Unique Visit:
=IF(D2=D1,IF(H2<30,"Within 30","New"),"New")
Put these formulas in first row and drag down to auto-fill.
Latest Recipee Register Date: Captures Recepee register date if the entry is last in entry of 30 days.
Formula:
=IF(D2<>D3,G2,IF(I3="New",G2,""))
Note: I see that your data is sorted with respect to date and other dates are sorted in ascending order as well. These above formulas will work when the data is sorted in ascending order for the all the dates. For other sorting the formulas will need to change.
I am trying to create a formula that offsets an "up-sell" amount 12 periods (columns) in the future.
For background: Each of our customers provides monthly recurring revenue (like a subscription. At the beginning of the model (1/1/18), I have a random number generator from 1-20 that calculates the period in which the customer could be up-sold.
As you can see in the photo and the formula that the IF statement looks at the random upsell period and adds in the additional revenue ($100) into that period and periods after that.
I am trying to create the formula so that once the if statement is satisfied (the random period >= the period that the cell is in) it adds the revenue 12 periods later, not in that period itself.
For example, Customer ABC's random upsell period is 3, instead of adding that revenue in period 3, I want it to add it in period 15 (12 periods later).
The formula that is currently being used is: =IF($B8>E$5,$C8,$C8+$D$3)
Please see attached image for reference, thank you]1
Not sure if that's what you are looking for and only works if your periods increments in 1 even after 12++ (13,14,15...).
Sorry you'll have to redefine the references but that gives you an idea:
In C5 : IF(C$4>12,IF(OFFSET(C4,0,-12)>=$A5,$C$2+$B5,$B5),$B5)
I have a Task month calendar. when i change the month of the calendar it shows me what I have to do which day of the month.
I basically have a list of task, when i change the month the tasks date automatically change accordingly a series of rules and that list will populate the calendar.
Calendar
Tasks
But I have some tasks that are bi-weekly, and I dont have a specific week to be done, they have to be done in the fortnight after the last time.
so I have the first week (day) that the task was done and i have the first day of the month i am... and with that i would wanted to know which days of the month i have to do that specific task.
Can you help me?
use the last reference point as the basis for creating the next due date. this would be the date the task was last performed. If it is due a fortnight from that last date then add 14 days. You may want to record the date that task was performed each time so that your formula is based on the date it was last completed each time it is calculated.
If you are wanting to plan ahead then make an assumption that it will be done in consistent 14 day iterations then build your formula to consider the actual date it was completed to readjust the plan going forward. So it will assume this will be done consistently until advised otherwise with an actual date it was last completed.
The trick is to get the first date in the month that matches the weekday of the last date and then you can easily add 14 days. Much like finding the first Monday/Sunday in a month to build a calendar.
A1 contains the last time the task was performed
C1 contains the 1st of the month
C1+7-WEEKDAY(C1+7-weekday(A1))
will return the next weekday that matches the weekday the task was last performed.
=C1+7-WEEKDAY(C1+7-weekday(A1))-A1
returns the number of days since
=(C1+7-WEEKDAY(C1+7-weekday(A1))-A1)/2
returns the number of days divided by 2. If this result is not a whole number (#.5) then it's not in the bi-weekly cycle and we need to add another 7 days to get the correct start date. If it is a whole number then it is our start date. We can use the mod function to find out if there is a decimal value.
=if(mod((C1+7-WEEKDAY(C1+7-weekday(A1))-A1)/2,1)>0,C1+7-WEEKDAY(C1+7-weekday(A1))+7,C1+7-WEEKDAY(C1+7-weekday(A1)))
Below or next to this cell you can simply reference the cell and add 14 =D1+14 and then add as many as you want to display.