Forum Discussion
Microsoft List formula is not working
Hi all,
I am encountering a problem in a calculated formula in the Microsoft List.
Scenario- Based on different values in different columns , I need a record to appear as "Overdue"
Formula used -
IF([Due date]="Missing info","Missing info",
IF(OR
(AND([Due date]<NOW(),ISBLANK([Result outcome]),ISBLANK([Date - Result marked])),
AND([Due date]<NOW(),[Require 2nd attempt]=TRUE,ISBLANK([Result outcome]),ISBLANK([Date - resubmission passed ]))),"OVERDUE",""))
This formula works fine in Excel. I tested it. This formula works on List only when I do any edits in the data.
As an example,
Due date = 17.07.2023
It will not show as an overdue record, until I open the record and do some edits on it. It is like an action should be performed on the record for the formula to work.
What can be the reason. If someone can help me on this, it would be greatly appreciated.
Thanks,
Imalka Jayalath
13 Replies
- SvenSieverdingBronze Contributor
Hi Imi_Jay ,
instead of using a calculated column you can also use JSON list formatting to achieve this effect.
That will recalculate automatically.
I translated your formula into this JSON (I hope i got the logic right){ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "=if([$DueDate]=='Missing info','Missing info',if(((Number([$DueDate])<=Number(@now)) && (toString([$ResultOutcome]) == '') && (toString([$DateResultMarked]) == '')) || ((Number([$DueDate])<=Number(@now)) && [$Require2ndAttempt] && (toString([$ResultOutcome]) == '') && (toString([$DateResubmissionPassed]) == '')),'OVERDUE',''))" }
Just select your column and then select "Column Settings" and then "Format this column"
Switch to "Advanced Mode " at the bottom of the new dialog
Now paste the JSON formatting into the editor and saveBest Regards,
Sven- Imi_JayBrass Contributor
SvenSieverding
Thanks! Logic is correct. For some reason it's showing Overdue for all the scenarios. Could that be the way column name like [Date - resubmission passed ] should be written in the JSON code differently? That's the only issue I can think of. Appreciate if you can look into this.
Thanks,
Imalka JayalathImi_Jay In SharePoint JSON formatting, you have to use the internal names of columns in format like [$InternalNameOfColumn] and not the display names of columns. So, try using internal names for all your columns which are referenced in the JSON.
You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- sbocknekCopper ContributorHey Sven,
This didn't work for me:
After following the steps, the column simply showed the entire formula as a text string (rather than executing it).
Do you know how to fix this, so that the formula actually executes? Thanks!sbocknek Make sure you did not miss the equal to ( = ) sign at the start of this expression:
=if([$DueDate]=='Missing info','Missing info',if(((Number([$DueDate])<=Number(@now)) && (toString([$ResultOutcome]) == '') && (toString([$DateResultMarked]) == '')) || ((Number([$DueDate])<=Number(@now)) && [$Require2ndAttempt] && (toString([$ResultOutcome]) == '') && (toString([$DateResubmissionPassed]) == '')),'OVERDUE',''))Also, use the correct internal names of your SharePoint columns. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Imi_JayBrass ContributorHi Sven,
Thanks very much.I will try this.I don't know JSON at all.Hence trying to find a solution that would go with A2 style formulas. I will try this. The logic should be fine.
Thanks,
Imalka Jayalath
Imi_Jay What is the data type of [Due date] column, single line of text or date & time?
Also, it is default behavior of SharePoint calculated formulas that calculated column values are calculated only when:
- A new item is created
- An existing item is updated
- Calculated column formula is updated
Check my answer given here for more information: Impact on Performance of Calculated Columns
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Imi_JayBrass ContributorHi Ganesh,
Thanks for the reply. Due date column is a date field.
That explains of the reason why the formula is working fine on Excel but not on the list.
Thanks,
Imalka Jayalath
- Lalit MohanIron Contributor
Hi Imi_Jay
The issue you're facing with the calculated formula in Microsoft List could be related to the automatic recalculation behavior of the formula. Unlike Excel, which recalculates formulas automatically, Microsoft Lists might require a manual trigger for the formula to update and display the correct result.
When you make edits to a record in Microsoft List, it triggers the recalculation of the formulas, which is why you see the correct result after performing some edits. However, for existing records that haven't been modified, the formula might not update automatically.
To resolve this issue, you can try the following steps:
Verify the list settings: Ensure that the "Automatic" recalculation mode is enabled for your list. You can check this by going to the List settings and navigating to the "Advanced settings" section.
Manual recalculation: After making changes to your list data, you can manually trigger the recalculation of formulas by using the "Calculate" or "Refresh" option. Look for these options in the toolbar or menu of your Microsoft List application.
Check for dependencies: If your formula refers to values from other columns or records, ensure that those dependencies are updated correctly. If any referenced values are not refreshed, it could affect the outcome of your formula.
Reevaluate your formula: Review your formula for any potential issues or logical errors. Consider simplifying or restructuring it to ensure optimal performance and accurate results.
If the problem persists despite trying these steps, it might be a limitation or bug in the specific version or implementation of Microsoft List you are using. In that case, reaching out to Microsoft support or the relevant community forums for further assistance would be advisable.
I hope this helps! Let me know if you have any further questions.
- Imi_JayBrass ContributorCan you please help me with the step 1. I cannot find the option to turn on the automatic recalculation mode.
Imi_Jay There are no settings (or concept) available for "automatic recalculation mode" in SharePoint?
Please ignore reply from Lalit as it is an AI generated reply and completely false information related to "automatic recalculation mode".
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Imi_JayBrass ContributorHi Lalit,
Thanks for your descriptive reply. I didn't find an option to verify the list setting. Can you please proved more specifics on that step? What is the sub heading of that option?
Thanks,
Imalka