Avoiding #NAME? Error/ Calculating date difference - sharepoint

I am creating a share point list that tracks our plan progress through the year. I have 2 date columns - [planned start date] and [actual start date].
I have the current formula in place:
=IF(ISBLANK([Activity Start Date]),"0",DATEDIF([Planned Start Date],[Activity Start Date],"YM"))
However, When the[actual start] is BEFORE the planned date, it gives me the #NUM? error rather than a negative value.
I have found previously the suggestion to use a formula:
=IF(ISERROR(DATEDIF(TODAY(),[Due date],"d")),"0",DATEDIF(TODAY(),[Due date],"d"))
I adapted it to fit my list:
=IF(ISBLANK([Activity Start Date]),"0",IF(ISERROR(DATEDIF([Planned Start Date],[Activity Start Date],"YM")),"0",DATEDIF(([Planned Start Date],[Activity Start Date],"YM"))
However, received a syntax error.

The following formula corrected this:
=IF(OR(ISBLANK([Activity Start Date]),ISERROR(DATEDIF([Planned Start Date],[Activity Start Date],"YM"))),"0",DATEDIF([Planned Start Date],[Activity Start Date],"YM"))
https://techcommunity.microsoft.com/t5/sharepoint/avoiding-name-error-calculating-date-difference/m-p/3681802#M66310

Related

Excel adding IFERROR to progress statement (conditional formatting)

enter image description hereFor example I have a start date cell and an end date cell. I also have a conditional format statement that will take these two cells and calculate the progress in % of how complete my project is.
For example:
Bathroom Renovation:
Start 11/7/2022
Finish: 11/9/2022
Progress 33%
Here is my excel code to calculate this:
=MIN(1, (DATEDIF(E11,TODAY(),"d")+1)/(DATEDIF(E11,F11,"d")+1))
I need to add an IFERROR (or some condition like) so that when there is no start or end date is says "Not Started" for example.
I have tried this:
=IFERROR((DATEDIF(B2,TODAY(),"d")+1)/(DATEDIF(B2,C2,"d")+1),"Not start").
That problem that I've run into with this is I am trying to cap the percentage at 100%, and the code statement I started with does that. When I enter this string of code, it works, however when a project is complete it will say 150%, 450%, etc. I need it to also cap at 100%
assuming E15 is your start date and F15 is your finish date, try:
=IF(ISBLANK(E15),"Not start",IFERROR(MIN(1,(DATEDIF(E15,TODAY(),"d")+1)/(DATEDIF(E15,F15,"d")+1)),"Not start"))
This will display the progress as not started if there is no start date.
The =MIN(1,"other code") part is capping the value at 100% in the first example and it is missing from the second. try:
=IFERROR(MIN(1,(DATEDIF(B2,TODAY(),"d")+1)/(DATEDIF(B2,C2,"d")+1)),"Not start")

Excel Help: Search for Second/Third iteration to find matched status

Two sheets of info
I've 2 sheets of data(but pasted in one sheet itself), in that I'm trying to find Status of each Job for a particular date based on the server name. And my formulas are working without any issues until no duplicates on the same date.
If the job runs twice / thrice on the same day then my condition fails. Now I want to add one more condition to qualify the time range.
Here is my conditions..
If the time is before 5 PM and the latest job which is near to 5PM is success then it should capture success.
And any jobs that is failed before 5 PM is a failure. And if it has Failed, Success, Failed before 5PM then it is Failed (coz the latest is failed).
Here I'm using one more formula to convert Text to Date format but I'm not converting time from that Text. Any help would be appreciated. And I'm fine to add one more column for Time aswell.
I'm using 2 formulas here..
=INDEX(I2:I8,MATCH(1,(A2=L2:L8)*(C1=J2:J8),0)) #to find status
=DATE((MID((TEXT(LEFT(K2,10),"mm/dd/yyyy")), FIND("/", (TEXT(LEFT(K2,10),"mm/dd/yyyy")), FIND("/", (TEXT(LEFT(K2,10),"mm/dd/yyyy")))+1)+1,256)),LEFT((TEXT(LEFT(K2,10),"mm/dd/yyyy")),FIND("/",(TEXT(LEFT(K2,10),"mm/dd/yyyy")))-1),(SUBSTITUTE(MID(SUBSTITUTE("/"&(TEXT(LEFT(K2,10),"mm/dd/yyyy"))&REPT(" ",6),"/",REPT(",",255)),2*255,255),",","")))
#to convert text to date
You could try this using 2 helper columns:
Helper Column 1 (Date)
Here I extracted the date from the field "Date & Time" with the following formula:
=DATE(RIGHT(MID(L2;1;FIND(" ";L2)-1);4);LEFT(L2;FIND("/";L2)-1);MID(L2;FIND("/";L2)+1;FIND("/";L2;FIND("/";L2)+1)-FIND("/";L2)-1))
Helper Column 2 (Flag Time)
Here I put a value to determine if the time is before 5 p.m. and which is the closer time to this hour.
First we have to extract the time value, so I used to formula to do it:
--MID(L2,FIND(" ",L2)+1,LEN(L2))
In order to determine if the time is before 5 p.m. I used (giving a greater value if the time is after 5 p.m.):
IF(Time<=17/24,0,10)
Finally I get a value related to how closer is the time to 5 p.m.
(17/24-Time)
And the final formula is:
=IF(--MID(L2,FIND(" ",L2)+1,LEN(L2))<=17/24,0,10)+(17/24-(--MID(L2,FIND(" ",L2)+1,LEN(L2))))
With these values on the helper columns now we can achieve what you're looking for. I'm using this array formula (don't forget to press Ctrl+Shift+Enter in order to works correctly):
=IF(SUM(($M$2:$M$8=$A2)*($J$2:$J$8=B$1))=0,"",INDEX($I$2:$I$8,MAX(IF(MIN(IF(($M$2:$M$8=$A2)*($J$2:$J$8=B$1),$K$2:$K$8,""))=($M$2:$M$8=$A2)*($J$2:$J$8=B$1)*$K$2:$K$8,ROW($I$2:$I$8)-1,""))))
And this is the result that we got:
You cand find an example here. (you have to download as an excel file to test it)

Fixed value every N months BUT with a specific start month

I want to schedule a fixed amount every 3 months BUT I want to specify when the first month should be.
I could get the scheduling to work every 3 months with the following formula where F5 is the interval and G5 is the amount:
=IF(MOD(MONTH(H2)-1,$F$5)=0,$G$5,0)
I believe the offset of -1 is the problem but I don't know how to replace the offset for the start date that I specify.
How do I start the schedule from 1/2/2019?
If I understand right, you want to repeat the fixed amount every 3 months, but you want to customize start date.
I got this:
My formula:
=IF(D1>=$A$2;IF(MOD(MONTH(D1)-MONTH($A$2);3)=0;$B$2;"");"")
My logic. If you want to make sure the date is every 3 months starting on your start date, it means that the difference between the month of start date and month of date must be 0, 3 or multiples of 3.
Hope you can adapt this to your needs.
I was able to schedule a fixed value every N period starting from a specific date.
I used the suggested answer and the formula
=IF(D2>=$A$6,IF(MOD(MONTH(D2)-MONTH($A$6),$B$6)=0,$C$6,0),0)
Example applicable to the formula

Nested If Statements in Excel /

Stackoverflow has been really helpful on my Nested IF confusions! I thought I'd ask one more question to help solve my seemingly complete lack of understanding the logic flow in Nested If's.
Current formula used in Cell (P3) is =IF(ISBLANK(M3),TODAY()-L3,M3-L3)
It works just fine, except for then there is no data in Start Date (L3) and Finish Date (M3). When both cells are Blank it shows the number 43,091.The logic that I need however is as follows.
If both start date (L3) and Finish Date (M3) are BLANK, Result an Empty Cell (P3).
If Start Date (L3) has a date, and Finish Date (M3) is BLANK, Count the number of days between Start Date (L3) and TODAY.
If Start Date (L3) and Finish Date (M3) both have Dates, count the number of days between Start Date (L3) and Finish Date (M3).
I hate to be a pest but i just cannot wrap my head around it and have struggled with this for probably 2 hours now. ANY Help is appreciated everyone! Thank you so much.
James
Add the test:
=IF(L3="","",IF(M3="",TODAY()-L3,M3-L3))

How to compare columns for related records in the same Power PIvot table (DAX)

I have a fact table consisting of schedule data tracked over many months. An activity will have an entry for each month. I want to see if an activity started and finished on time by comparing each activity's start and finish dates to the previous month's forecasted start and finish dates.
Here is an example of what I want. The Started/Finished On Time columns are the calculated columns I want to make.
Example 1: Activity 1 did not start or finish on time in November, but did start on time in December. It did not finish on time so the Finished on Time column is marked "late".
Example 2: Activity 3 started earlier than was forecasted (12/7 start vs. 1/5 start). So it should be marked as starting early.
So pretty much the following needs to happen in the Started on Time column (similarly in Finished on Time column):
For each row, find the same activity from last month and compare the start dates (I think I can figure the rest out but this is the real challenge at the moment)
If the current row's start date is in the same month as the snapshot date and is in the same month as the
forecasted start from the other record OR if there is no previous month's record, then return "On Time".
Otherwise, if the current row's start is in the same month as the snapshot date but earlier than the start date from the previous month, return "Early"
Otherwise, if the current row's start is in the future and the previous month's start date was in the future, return "Not Started"
Otherwise, return "Late"
Is this even doable? I feel like this would require some careful use of LOOKUPVALUE and EARLIER, but I'm not sure how to go about it.
Looks like this describes how to do it in Power Pivot completely: Can I compare values in the same column in adjacent rows in PowerPivot?
Performance problems can be solved by moving this partly or completely to Power Query: http://www.powerpivotpro.com/2015/03/how-to-compare-the-current-row-to-the-previous-row-in-power-pivot/

Resources