Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to use a chain in a formula ?

Hello, I want to make a calculation using values from another cell but it gives the error "expected number but found chain".


content of B2: 5*2*3

content of B3: =B2


How can I make it compute B2 ?

iMac, Mac OS X (10.6.8)

Posted on Feb 19, 2013 12:38 PM

Reply
7 replies

Feb 19, 2013 2:42 PM in response to Somolian

You are trying to convert a string that looks like a formula (contained in cell B2) and have the result of the formula be calculated in cell B3, right?


Two ideas:


Idea 1: If you format B2 as text then enter the text =5*2*3 then change the cell format to Automatic, it will do the calculation in cell B2. You can convert it back to text to see the formula again.


Idea 2: Use an Applescript. The Applescript would copy the string from B2, put the "=" at the beginning and put it into B3. B3 will calculate the result. You can design the script to do this for multiple sets of cells. An example is below for you to try out. If you like it we can make it so it can be started with a keyboard command. Not quite sure how we'll stop it with a keyboard command, though


  1. Open the Applescript Editor application
  2. Copy the entire script from below
  3. Paste it into Applescript Editor
  4. Open a new Numbers document
  5. Put a formula into cell B2
  6. Run the script
  7. When you are done testing it out, stop the script. Otherwise it will run forever.


tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1

set vold to ""

repeat

set vnew to ("=" & value of cell "B2")

if voldvnew then

set value of cell "b3" to vnew

set vold to vnew

end if

end repeat

end tell

How to use a chain in a formula ?

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