Stuck on copying one column data to another

Hi! I thought this part was easy but apparently, it is not. How can I copy one column data to another column? Below is the formula I have with a button but it it copies just one value in the entire column. Here is my sheet, you might need to request access to the sheet.

[Projects].Foreach(
    ModifyRows(
      [Projects],
      CurrentValue.[Previous priority],
      CurrentValue.Priority
    )
)

This should work, assuming you want to populate the [Previous Priority] column with the [Priority] columns value.

You can write it as

[Projects].Foreach(
    CurrentValue.ModifyRows(
     [Previous priority],
      CurrentValue.Priority
    )
)

The first item to pass to the ModifyRows using this approach is the name of the column, the second item is the value to set the column.

2 Likes

wow thanks @Daragh_O_Shea1 ! It works! Can I ask why you did CurrentValue.ModifyRows? The foreach already iterates through each item , why did you need to prepend CurrentValue to it as well?

In a ForEach loop on a table like this, CurrentValue is the current table row in the loop

Prepending the formula is just a different way to write it. It could also be written like this:

Projects].Foreach(
   ModifyRows(
     CurrentValue,
     [Previous priority],
      CurrentValue.Priority
    )
)

Each row is being updated individually in the loop

1 Like

Thank you for the explanation! I reread the definition of ModifyRows and I did see that the first input was a row, not a table. :slight_smile: Cheers!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.