SOLVED

Calculated column in Sharepoint List loses changes to formula

Copper Contributor

I'm trying to use the built in ID column in the Sharepoint List to add to a "Device ID" for an IT inventory list. My idea is to take the row "ID" number and add a couple of zeros in a new Column called "LineID" and then use the result in a DeviceID column which also takes other information from the Sharepoint List to create the DeviceID.

 

However i have found some weird behaviour - I'm not sure if my code is being changed (because it's wrong - i wouldn't be surprised) or if it's not being saved properly.

 

If I create a new record (using a flow in Power Automomate) I get this - look at the bottom of the grab:

 

jonengland_0-1700841796142.png

see the zeros under LineID?

 

The current formula in LineID is this:

jonengland_1-1700841893288.png

If i change it to to this:

 

jonengland_2-1700841943151.png

and resubmit the Power Automate:

jonengland_3-1700842063708.png

so it fixes it - and the previous incorrect records.

 

Checking back on the formula - it has reverted back to the pre-edit.

 

jonengland_4-1700842155860.png

and then resubmitting again:

jonengland_5-1700842434219.png

I've also created a new LineIDv2 column and the behaviour is the same.

 

I also have code which creates the string in the Device ID which should include the LineID at the end e.g. LHQW062 but this isn't working either - when it used to... so confused right now!

 

jonengland_6-1700842715613.png

=IF(Item="Laptop","L",IF(Item="Desktop","D",IF(Item="Server","S",IF(Item="Printer","P",IF(Item="iPhone","iPh",IF(Item="iPad","iPD",IF(Item="Android","Droid")))))))&""&IF(Location="Harpenden Office","HQ",IF(Location="Home Office","WfH"))&""&IF([Computer OS]="Windows","W",IF([Computer OS]="MacOS","M",IF([Computer OS]="Linux","L",IF([Computer OS]="N/A","-")))&""&LineID)

 

Any advice welcome!

 

Thanks,

Jon

 

 

 

 

 

5 Replies
best response confirmed by jonengland (Copper Contributor)
Solution

@jonengland 

 

Using ID column in SharePoint calculated column is not supported by Microsoft offcially.

 

However, if it is returning correct ID in calculated column for you, try using this formula for LineID column: 

 

="00"&[ID]

Wrap 00 in double quotes.

 


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.

@ganeshsanap Thanks, i tried it - and it behaves as before - the square brackets disappear after submitting a new line.

jonengland_0-1700853295795.png

 

I guess that if using ID in a Calculated Column is not supported, i need to find a different way. I'm not great at programming - do you have any suggestions?

 

@jonengland This is a default behavior in SharePoint calculated formulas to remove the square brackets for the columns having 1 word name (Example: Title, ID, Created, DeviceID etc.) after saving the formula.

 

Square brackets are required only when you have more than 1 words in column name or when you have space in column name (Example: [My Column 1], [Due Date], [Email Address]).


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.

Thanks for your help on this @ganeshsanap - It's looks as though Microsoft not supporting the ID column's use in Calculated Columns is causing my issue here. Thanks for that info!
Thanks for the explainer on square brackets @ganeshsanap - very helpful!
1 best response

Accepted Solutions
best response confirmed by jonengland (Copper Contributor)
Solution

@jonengland 

 

Using ID column in SharePoint calculated column is not supported by Microsoft offcially.

 

However, if it is returning correct ID in calculated column for you, try using this formula for LineID column: 

 

="00"&[ID]

Wrap 00 in double quotes.

 


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.

View solution in original post