Sharepoint - How to use calculated field to retrieve the ID of the item in the SharePoint 2007 List?
If you need to use the ID in a calculation, the best approach is to do the calculation in a workflow and set a column to the value returned by the calculation.
IDs can work in calculated columns, they are unreliable, speaking from experience. Now I always use On creation and on change workflows in situations where I absolutely have to use the ID value in some sort of calculated column.
Thanks everyone for your help but I have do some testing and notice that I can simply use =[ID]
to retrieve the ID even though the ID is not listed inside the "Insert Column" list box.
Kind of quite surprise for me as I thought that the ID field will be display in the "Insert Column" rather than hidden.
(Do let me know if it does not work in your case.)
Unfortunately I don't think you can include ID as part of a calculated column. It's been a while since I looked at this but from memory I think it has to do with the ID column having a null value until the item is saved for the first time, so SharePoint doesn't allow it.
A workaround that I've used in the past is to implement an event handler on the list which will update a custom integer column on the list with the item id after the ItemAdded event has occurred. Your calculated column can then use this custom column as part of its calculation.