How to create a number field with prefix (ex: 00001) that increments whenever a document is added in SharePoint Online? - sharepoint

I created a calculated column and concatenated the id with a prefix, but it didn't work as expected.
The reason was that whenever i upload a file, the formula in calculated field that contains the ID with the prefix is executed, then SharePoint creates the ID.
So, the ID is being calculated as empty and only the prefix is showing.
What I used:
=CONCATENATE(REPT("0",MAX(0,5-LEN(ID))),ID)
What i would like to create is a number field with a prefix (ex: 00001) that increments whenever a document is added in SharePoint Online.
In other words, it's like the ID column in a list but with a prefix of five digits.
Therefore, is there any solution for this problem?
Thank you 😁.

Using the calculate column formula, when creating an new item, the ID column and the calculate column are created at the same time, so the value of the ID column cannot be obtained, so the calculate column will be displayed as 0.
But you can solve this problem by creating a flow.
Please refer to the screenshot below:

Related

Excel2016: Generate ID based on multiple criteria (no VBA)

I am trying to generate Batch ID based on Course, Date, & Time. All the rows which have the same Course+Date+Time combination should have the same Batch ID. All subsequent combinations should have incremental IDs
Batch ID = LEFT(C2,3)&TEXT(<code formula>,"000")
No VBA, only Excel 2016 formula, please.
Sample data snapshot
Bit of a stretch but try in F2:
=IF(COUNTIFS(C$2:C2,C2,D$2:D2,D2,E$2:E2,E2)>1,LOOKUP(2,1/((C$1:C1=C2)*(D$1:D1=D2)*(E$1:E1=E2)),F$1:F1),UPPER(LEFT(C2,3))&TEXT(MAX(IFERROR((LEFT(F$1:F1,3)=LEFT(C2,3))*RIGHT(F$1:F1,3),0))+1,"000"))
Enter through CtrlShiftEnter
It would be easier and more readable to meet your requirement in three steps, rather than a single formula.
Create a unique ID based on the Course, Date and Time.
Formula:
=CONCATENATE(UPPER(LEFT($C3,3)),TEXT($D3,"ddmmyy"),TEXT($E3,"hhmm"))
Breakdown:
LEFT($C3,3) - take the first three characters of the Course
UPPER() = make the first three characters of the Course uppercase
TEXT($D3,"ddmmyy") = take the date, turn it into text and apply a format
TEXT($E3,"hhmm") = take the time, turn it into text and apply a format
Create a lookup table of the unique ID and Batch ID
Copy all the unique Ids that have been created in step 1
Paste them into a new column separate to your data
On the Data menu tab, select Remove Duplicates in the data tools
Add the Batch ID to lookup.
This way the Batch ID can be generate via formula if the Unique Id's are sorted using Sort A to Z.
See the attached image.
Lookup the unique ID to get the Batch ID
=VLOOKUP($F3,$I$3:$J$7,2,FALSE)

Dynamic validation list in Excel

I have an issue regarding data validation in Excel, namely how to dynamically set the validation source.
I have three tables, where the first contains a product ID and a product name. The second table contains a product ID together with a serial number. A third table has three columns; one for product ID, one for serial number and a description for e.g. error reporting.
What I want to do is related to the third column where I select the product ID in a drop-down box which is linked to the first table. This works perfectly fine. The second column though, must only allow serial numbers related to the product ID selected according to the relationship in the second table. Hence, the data validation list must be dynamically generated by the input in the first column.
The reason for having it in Excel is due corporate reasons and personally I'd use an SQL-database for this very issue. E.g. if I were to use SQL-syntax to generate the validation list, the corresponding SQL-statement would be:
SELECT serialNumber WHERE productId = 12345;
I've tried using the INDEX-MATCH, but unfortunately MATCH only returns a scalar value rather than an array. I have not come across array functions prior to today, but I assume such might be included in order to accomplish this and have tried a bit without success.
If I somehow were to acquire an array returning the row numbers where there is a match, the INDEX-function would accomplish my needs, I presume.
My question is therefore, is there a method to acquire an array of matched values or can my problem be solved using a more elegant solution? If it could be of value if it can be made without VBA, also for corporate security reasons.
Thanks in advance!

Sharepoint calculated field long time to calculate

I have made a SharePoint list that has a calculated field that is used as a unique identifier for each item. The field is calculated using the item id. The formula is as follows:
="TY0"&(TEXT([ID]+3200,"#####"))
The problem is that the calculation is seeming to take 20 mins or longer to happen. The field will show as "TY032000" until he calculation happens. If the field is changed via settings or SP designer and then changed back to the original formula, the calculation happens with no issues.
Same answer and some more workarounds at: columns dereferencing in SharePoint's calculated column
It is not 20 minutes, you can wait forever if an Item is never changed.
ID is empty for NEWly created items because the Formulas run BEFORE the Item is written to the List where it gets its ID value.
ID is not listed as an available Column when you create a Calculated Column.
As you experience, ID is updated when an Item is changed.
So add a Workflow which updates (anything in) the Item on New Item creation to trigger update of the Formula (now using the correct ID value)

Lookup value in column to display name

I've got 2 columns - Name ID and Name.
When a user adds a new entry to the sharepoint datasheet in the form, they have a dropdown list of all names (around 20 in total).
What can I do, so that when they select the name, the Name ID field auto-populates with its corresponding details?
Is there somewhere I need to hold this data and how do I go about creating these calculated columns?
Thanks in advance
You should just be able to do something like this
=TEXT([NameIDcolumn])
# Or
=CONCATENATE("You selected:", [NameIDColumn])
However, you cant use the value from the ID column or any think like that in a calculated col since the value does not exist yet. The SharePoint dev team was most likely smoking crack when creating that datatype since a lot of good stuff that should have been there isn't.
You have the complete reference of stuff you can make with calculated columns here http://office.microsoft.com/en-us/windows-sharepoint-services-help/CH010065006.aspx

Display column from one Sharepoint list into another list

I have one Sharepoint list that contains training courses and duration (in hours). I have another list where users can enter the training they have and plan to take (using a Lookup column connected to the first list)
Is there a way I can bring over that Hours column to display on the second list? I only have access to the vanilla web parts and SPD, and I am not allowed to add third-party stuff (solutions/web parts) on the SP servers.
I just need that Hours column to appear in the list itself without users needing to click the lookup field (course title)
If you have multiple column field type and you use that as lookup field. You can get two column values in one field. It will show up as two different columns on list but you will need render templates for input forms. Check this out for basic idea
http://msdn.microsoft.com/en-us/magazine/dd727508.aspx#id0450138
Create a field type for course list
Create render template for MCV and extend SPFieldMultiColumnValue
Make that field as Lookup Column
You have to check if you can do second step using SPD only. Also another way to do it is using Multiple column lookup field
HTH

Resources