Hi
@petewalburn,
The key is to split both columns simultaneously using a numeric index to pair values by position.
Instead of iterating over one split column, use Sequence to generate row numbers, then use Index to pull the matching value from each split at that position.
ClearCollect(
collDandO,
ForAll(
Sequence(CountRows(Split(fieldIDs, ","))),
{
IDno: Value(Index(Split(fieldIDs, ","), Value).Value),
Order: Value(Index(Split(fieldOrder, ","), Value).Value)
}
)
)
Sequence(CountRows(Split(fieldIDs, ","))) generates a numbered sequence, one per item in the comma-separated string. Value inside the ForAll refers to the current position number. Index(..., Value).Value then picks the nth item from each split result, keeping both columns in sync.
One thing worth checking: both comma-separated strings need the same number of items. If fieldIDs has 3 values and fieldOrder has 2, the Index call on the shorter string will return blank or error on the last row.
The original approach of ForAll(Split(fieldIDs, ",")) only iterates over one column. There is no way to reference the nth item of a second split inside that loop without using Index on the full split result, which is what this formula does.
This pattern scales as the SharePoint list grows with no changes needed to the formula.
Thank you!
Proud to be a Super User!
📩 Need more help?
✔️ Don’t forget to Accept as Solution if this guidance worked for you.
💛 Your Like motivates me to keep helping