Error in Calculated Column (using Today) in DataSheet View - Sharepoint 2010 - sharepoint

I have calulated column which display's the value based on the difference between today and requested date field.
=Today-[Requested Date]
This is working fine in Sharepoint Standard View. But the same is not working with the datasheet view . The calculated column is showing as below
=#NAME?-[Requested Date].
Due to this i am not able to save the data. Can anyone please let me know how to solve this ?

Which SharePoint version are you using?
I tried the same scenario using SharePoint 2013 and was able to add the values in both standard and datasheet views. I am assuming you might have used the same steps.
Create 2 new columns named RequestedDate(DateTime) and
Today(Single line of text).
Add a new column of type calculated field with formula
=Today-[Requested Date].
Now delete the Today column.
Try entering the data in both the views.

First I have used today() function to calculate difference between 2 days except working days. The list is not automatically updating. If we change the Start_Date, then it calculates and gives the value. Can you suggest me why this happens?
You have mentioned in your post that there is some tricks in using today() function. I have created separate Today_Date column in my list. And Used the same column name in finding difference between 2 days. Here also the same problem exists.
The formula I used is,
=IF(AND((WEEKDAY([Today Date],2))<(WEEKDAY([Release Date],2)),((WEEKDAY([Release Date],2))-(WEEKDAY([Today Date],2)))>1),(((DATEDIF([Release Date],[Today Date],"D")+1))-(FLOOR((DATEDIF([Release Date],[Today Date],"D")+1)/7,1)*2)-2),(((DATEDIF([Release Date],[Today Date],"D")+1))-(FLOOR((DATEDIF([Release Date],[Today Date],"D")+1)/7,1)*2)))
Please tell me how to make the difference between 2 date values update automatically every time I open the list.
Then I tried the trick which you have mentioned above. But it works while I enter the data. When I open the list for the next day or some other day's after the Calculated column is not taking the current day's value, do the data remains same. what should I need to do in case it needs to take current date's value and calculate the formula?

Related

Add x Days to a Date Based on vlookup Output Excel

What I'm trying to do is give a due date based on an input date, type of review, and department.
For example if the department is ABC and the review is retrospective, the due date will be the input date + 30 days.
But if the department is ABC and the review is concurrent, then the due date will be input date + 1 day.
I know I can concatenate the department and review into the vlookup table but I'm not so sure how to get the output to be the due date that I want.
Can anyone help?
EDIT:
Per the first answer below, I hashed out an input table with concatenated columns just in case I needed them. It is a bit more complicated than I originally thought.
Input table with date logic
I'd love to simply edit the source data but the report isn't readily available in the database. Could I still use the suggestions below?
Assuming you have a lookup table for the number of days to add depending upon the department and review type similar to the one below, you can use an INDEX/MATCH/MATCH and simply add it to the input date:
=$A2+INDEX($H$4:$J$5,MATCH($B2,$G$4:$G$5,0),MATCH($C2,$H$3:$J$3,0))
SOLUTION FOR AN ALTERNATIVE LOOKUP TABLE LAYOUT
If your layout table is more like as below, you can use a MINIFS formula (or MAXIFS if you would prefer):
=$A2+MINIFS($I$3:$I$8,$G$3:$G$8,$B2,$H$3:$H$8,$C2)

Fetching date value from a SharePoint-list, to use in date&time specific field in flow

I'm trying to design a Microsoft Flow, which will create a outlook calendar event entry based on information in a SharePoint-online list.
The list will contain a value for a DueDate its a column of type Date, not including time.
I want to be able to create a outlook calendar entry on the date based off the duedate column. The calendar entry form in flow allows via dynamic content to add dates that also include time, however date columns not containing time cannot be added that way.
Is there a workaround to this, some expression that would allow me to fetch values from columns more freely and then possible append a time to it
I have tried converting the column in sharepoint to a Date with Time column and that workaround worked, however its not what I'm looking for. Id like to know how to be able to work around this because I don't necessarily want my column as a date-time column which can cause problems later on.
I have tried this expression:
formatDateTime(concat(item()?['DATE'], '08:00')'yyyy-MM-ddThh:mm:ss')
But I know this is wrong and it doesn't work. I'm simply not sure how to do it.
https://puu.sh/Df5ni/05cb882b23.png
I want the flow to add a calendar entry based off the due date column which i can append my own time to like the start of the day and last til the afternoon.
Actual results are I don't seem to be able to use a date column, just a date-time column for start and end times of the event, date column without time doesnt appear in the dynamic content list.
If there is some way to manually fetch values instead of using the dynamic content that is very powerful and can then possibly be converted to the right format using additional code.
Date column name in my list is date_without_time of type Date (Add time set to NO):
New element:
Function used in Create event (V2) action:
formatDateTime(triggerBody()?['date_without_time'],'yyyy-MM-ddT09:35')
Result:
Calendar:

Excel - Nested IF/Nested AND/OR in 'calculated field' option - pivot table

I have the following problem:
A datasheet with a column (HOUR) and another column (AM/PM). Entries in the first column consist of 1,2,3,4,5,6,7,8,9,10,11, or 12, the second column consists of 'AM's or 'PM's. Together they define the time of an incident (regarding the below problem, note that I am not allowed to create a new column in the source datasheet or change existing columns). The below formulas 1.) to 3.) work excellent for getting '1's or '0's for incidents that happened either between 8AM and 4PM, or outside of this time window, as long as I create a new column somewhere.
1.) =IF(AND(A1>=8, A1<=11),IF(B1="AM",1,0),0) + IF(AND(A1>=1, A1<=4),IF(B1="PM",1,0),0) + IF(AND(A1=12),IF(B1="PM",1,0),0)
2.) =--OR(AND(A1>=8, B1="AM", A1<>12), AND(OR(A1<=4, A1=12), B1="PM"))
3.) =--OR(AND(OR(A1={8,9,10,11}),B1="AM"), AND(OR(A1={1,2,3,4,12}), B1="PM"))
However, I want the "1"s to be summarized - without creating an extra column - as calculated field in a pivot table. While excel doesn't accept the 3.) formula at all in the calculated field option, excel accepts 1.) and 2.), but puts out only "0"s in all pivot cells. The below is one of the formulas that puts out only "0"s in the pivot table.
=--OR(AND(HOUR>=8,'AM/PM'="AM",HOUR<>12), AND(OR(HOUR<=4,HOUR=12),'AM/PM'="PM"))
The field value settings don't make a difference, and the fields that are created new with 1.) or 2.) cannot be filtered for "1"s or 0"s, so something must be wrong with the field calculation I guess. Does anybody know what I need to change to make it work? Are there special rules for formulas in pivot tables that apply to formula 1.) and 2.) to make them work?
Thanks for any help on this
I think the limitation is not you, but Excel.
See here for description of what is possible, as well as this question
I tried your code and indeed I see it's not working. Even with a simple if code it doesn't seem to work. I think it's is explicitly called a calculated field because you are only able to calculate the fields in the Sum/Total/Count etc. column.
Have a look at MS, this function is quite limited.
I would try to make another work-around to accomplish your goal.
Microsoft

SharePoint Date Shows as Number

Regardless of what I do in SharePoint 2010, one of my calculated columns show date as a long integer. Please see screenshot.
My formula is below and it doesn't seem to respect it. I changed the column from date time to date. Created a new task and you see the date populates as I would want it on one of the tasks; but it doesn't for my older list items. Please advise.
=IF([Move to MTR2 Date]<>"",TEXT([Move to MTR2 Date],"mm/dd/yy"),IF([Move to MTR2?]=TRUE,"Requested",""))
Then get the date as
MONTH(date)&"/"&DAY(date)&"/"&YEAR(date)

Any solution to the Today Calculated Column problem is SharePoint?

I would like to be able to use today's date in a calculated column in a SharePoint list to, for example, determine whether a task is overdue. There is a well-documented trick that involves creating a dummy column named "Today," using it in a formula, and then deleting it, thereby "tricking" SharePoint into using the Today function.
The problem is that this method does not work reliably -- the calculation is not dynamic; it is only made when the item is saved, and therefore the Today "column" effectively becomes the Modified Date. (This is probably why SharePoint won't let you use the Today function in a straight-forward way.)
Has anyone found a solution that works? I know I can use javascript to get the actual date on the client side and display colors, flags, whatever, but I am looking for a "server side" solution.
For reference, the Today column trick and its problems are described fairly well at these two posts and associated comments:
http://blogs.msdn.com/cjohnson/archive/2006/03/16/552314.aspx and http://pathtosharepoint.wordpress.com/2008/08/14/calculated-columns-the-useless-today-trick/
There simply isn't a work around for this. As the values for the list are stored in the database and returned "as is" to other featurs such as the search crawler, a dynamic field cannot be created.
It is possible to create a custom field that will display the value using todays date in its calculation.
In addition to Christophe's (PathToSharePoint)'s article this also covers the Today trick and why it doesn't work
The Truth about using Today in calculated columns
There are a number of fudges, probably the best one is Dessie's console app (mentioned above by MNM)
Dynamically updating a SharePoint calculated column containing a Today reference
Its good but its not perfect, for example you may have to worry about different timezones.
Before going down this route you should ask yourself if you really, really need to do this. For example :-
If you want a countdown (days overdue/days left to complete a task) then you can use SPD and a XLST Data View web part
If you want a view to show overdue items or items created in the last X days ec then you can use [Today] in a views filter 2
If you create a Today column it needs to be updated. You can do that with either a timer job or by placing a jquery script on a page that is hit by the user. The script could call SPServices.SPUpdateMultipleListItems to do the update. Pass a CAML clause so that you only update the list items where the Today value needs to be updated, e.g. once per day.
My advice is to create your on field that does this calculation for you and then reference it in your SharePoint list. Not a simple implementation but it would work.
I have been looking for a solution either, still no luck.. The Today column trick has the limitation of not being dynamic.
I do have one suggestion though, why don't we create a timer job that will update a certain a certain column with the current date every day at 12 AM. I know some of you all might think it an over head. Just my suggestion :D!!
I came up with a very rough, but working solution to this problem without having to do any coding. I'll explain both how i made the today column and how i worked that in to an overdue column, becuase that column was a pain to find out how to do as well.
First, I made a column named "today" (gasp!). Next I made a column named "Days Overdue". I then opened up sharepoint designer and created a new workflow. I set it to run every time an item is edited/updated (keep in mind I turned off versioning for this list, otherwise I would have had to resort to coding to avoid a bunch of useless data building up on our server). I set the actions to simply store the modified date in a workflow variable, then change the value of the today column to that variable. although the modified column is a date/time and my today column is just a date, it transfers just fine. I then set the workflow to pause for 2 hours. you can set this to whatever amount of time you want obviously, it will just change the latest possible time for your today column to update, i.e. 2AM in my case.
on to the days overdue column. this is the code for that guy -
=IF([Due Date]>Today,"None",IF([Date Closed]=0,Today-[Due Date],IF([Due Date]>[Date Closed],"None",IF(Today>=[Date Closed],[Date Closed]-[Due Date],IF([Due Date]<Today,Today-[Due Date])))))
This shows the days overdue in number form in days, or if its not overdue, it shows "None". You can use either a number format or a string format, but NOT A DATE FORMAT. Well, I hope this helps anyone who is running into this problem and doesn't want to have to delve into coding.
EDIT: I forgot to say that in the code above for the days overdue column, I put in that if today is past the date closed, to use the date closed minus the due date instead of today minus due date, to ensure that the calculation doesnt keep occurring after an item has been closed. you probably would have noticed that in the code, but i felt i should point it out just in case.
EDIT 2: The code I had in before my 2nd edit for my calculated column didn't calculate the days overdue properly after an issue had been marked "closed." I put in the updated code. The last part of the code doesn't make sense, as it is the same logic as the beginning, but it worked so I didn't want to take any chances! :)
Peace.
I've used the following and had no problems.
Field Name: Overdue
Field Type: Calculated
Data Type Returned: Yes/No
Formula:
=AND([Due Date]<NOW(),Status<>"Completed",[Due Date]<>"")
Here is a workaround:
Create a date column called Today.
Use this column in your calculated formula (ignore the fact that the formula returns a wrong value).
After you are done with the formula, delete the Today column from your list.
For some reason it works this way! Now Sharepoint treats the Today in your formula as today's date.
Note: If you decide you want to change the formula, you have to create the Today column again. Otherwise, it wouldn't recognize Today as a valid column.
I Tried #Farzad's approach and it seems to be working perfectly. I wanted to do a custom count on Days Elapsed so added a calculated column which previously I was using a difference between the Created Date and Modified Date Columns, which was only showing up whenever a user updated the post, much to my dismay.
I now have a formula which works as I would want to and uses the Today column, and here it is for anyone who would like to use it. I also have a Status column on the basis of which a base of On Hold is used, and the remaining formula are based on the date difference of Today - Created.
=IF(Status="On Hold","On Hold",IF(AND(Today=Created,(DATEDIF(Created,Today,"D")=0)),"New",IF(AND(Today<>Created,(DATEDIF(Created,Today,"D")=0)),"New (updated)",IF(DATEDIF(Created,Today,"d")>3,"Need Update Immediately",IF(DATEDIF(Created,Today,"d")=1,"One day old",IF(DATEDIF(Created,Today,"d")=2,"Two days old",""))))))
Basically its just a bunch of nested IF conditions which get me labels on the basis of which I can add a group to my view and filter out data if needed. Hope this helps anyone looking for an answer!

Resources