Copying an entire row with formulas in each cell and pasting to a different document

I have multiple documents with almost the same information in each table. I added a new row to document #1. Each cell in that row has a formula. Now I want to add that row into document #2, but when I copy the row and paste into document #2, it only pastes the value of the formula, not the formula itself. I would manually update each cell but there are over 20+ cells in the row that I need (and 8 documents that I would need the new row added to). So that's manually updating over 160 cells (and each cell's formula is complicated and has an if/search formula with 6 different searches). VERY tedious to update manually.


Is there not a way to copy a row (which includes the formulas for each cell in that row) to another document?

iMac (M3, 2023)

Posted on Apr 16, 2024 11:52 AM

Reply

Similar questions

2 replies

Apr 16, 2024 8:44 PM in response to fivealarmjockey

If a formula refers only to cells within the same table, it will copy/paste to the other document. It appears that your formulas refer to cells in a different table. Even if that same other table exists in the other document it won't paste the formula.


SGIII wrote a script nearly a decade ago that will convert formulas to text in their cells. Select the row(s) you want to copy and run the script and it will turn the formulas into text so you can copy/paste them to the other document. After that, format the cells (or just the formula cells) as "automatic" to turn the formulas back into formulas (in both tables). You can use "undo" in the original table instead of reformatting but it is a cell-by-cell process so it might be a lot of undos if it was a lot of cells.


Try it on a sample document before trying it on your real one. I don't know if SGIII has made any changes to the script over the years. It is also possible that your copy/paste operation could be done with a different script (yet to be written) that would not alter the original table.


tell application "Numbers"
	tell document 1 to tell active sheet
		set t to first table whose selection range's class is range
		repeat with c in t's cells
			if c's formula is not missing value then
				set c's value to "'" & c's formula
			end if
		end repeat
	end tell
end tell

Copying an entire row with formulas in each cell and pasting to a different document

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.