I need to test if a formula returns the correct result if given the correct input values.

Indystick

Board Regular
Joined
Mar 2, 2018
Messages
60
I am a college professor who has students complete applied exams in Excel. I have created a "scorecard" that compares the output of formula in a cell to what I know to be the correct output, and if they're equal, assigns them points. For example, imagine the following simplified example:

Student's Work

AB
11Seed Value
22Formula in A2: =A1*2
34Formula in A3: =A2*2
48Formula in A4: =A3*2

<tbody>
</tbody>

Correct Answers
ABCDE
51Formula in A5: =A1ScoreTest Formula in Col D
62Formula in A6: =A5*21=IF(A6=A2,1,0)
74Formula in A7: =A6*21=IF(A7=A3,1,0)
88Formula in A8: =A7*21=IF(A8=A4,1,0)

<tbody>
</tbody>

This works fine in all cases for testing the value in cell A2 because A2 is a constant and the input for the student's formula and the scorecard comparison formula will always be the same.

However, problems emerge in the scorecard for evaluating cells A3:A4, because they are dependent on the formula in cell A2 returning the correct result. The reason this is a problem is because the formulas in A3:A4 could be the correct formulas (which is what I care about from a testing perspective), but return the wrong values because the formula in cell A2 is wrong:

Student's Work
AB
11Seed Value
21Formula in A2: =A1/A2
32Formula in A3: =A2*2
44Formula in A4: =A3*2

<tbody>
</tbody>

Scorecard
ABCD
51Formula: =A1ScoreTest Formula in Col D
62Formula in A6: =A5*20=IF(A6=A2,1,0)
74Formula in A7: =A6*20=IF(A7=A3,1,0)
88Formula in A8: =A7*20=IF(A8=A4,1,0)

<tbody>
</tbody>

Even though the formulas in cells A3 and A4 are correct, they return the wrong value because the precedent in A2 is wrong.

What I would like to do is, first test if the values in the two cells are equal (e.g., A6=A2), and if so assign points; but if they're not equal, then compare the results of the student's formula if given the right inputs with the correct answer. In the second example above, I would replace the cell reference A2 in the formula residing in cell A3 with the cell reference A6 and evaluate, then compare to the correct answer.

So, long story short, what I need is a way either via formula/function/VBA of extracting the students formula from a cell, replacing the cell references with corresponding cell references in the comparison table and calculating the result. I don't know if this is even possible, but if anyone has an idea on how this nut might be cracked, it's the folks here.








 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,214,927
Messages
6,122,309
Members
449,080
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top