Checking that the formula is correct and not just the result

lynxbci

Board Regular
Joined
Sep 22, 2004
Messages
201
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi,
I have a cell with a formula syntax preceeded by an ' to show the formula
So for example i may have in cell A1 '=max(e13:e300)

The user is required to enter a formula into a cell B1.

It is a training spreadsheet and i want to compare the result of the formula, which is fine, but would also like to make sure they have used the correct formula syntax to get the result.

I can not use = as one is the formula and 1 is the result of the formula.

Any ideas?

Thanks as ever
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Activate cell with apostrophe and run procedure:
Code:
[COLOR="Blue"]Sub[/COLOR] CheckFormuala()
    
    [COLOR="Blue"]If[/COLOR] Evaluate(ActiveCell.Text) = ActiveCell.Offset(0, 1) [COLOR="Blue"]Then[/COLOR]
        MsgBox "Correct"
    [COLOR="Blue"]Else[/COLOR]
        MsgBox "Incorrect"
    [COLOR="Blue"]End[/COLOR] [COLOR="Blue"]If[/COLOR]

[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0
When you say that you want to check the formula syntax, do you mean that the formula will be exactly the same as the entry in cell A1?
 
Upvote 0
Yes i want to check they have entered the 100% correct syntax
Ideally with a simple check not a function

Thanks
 
Upvote 0
Code:
[COLOR="Blue"]Sub[/COLOR] CheckFormuala()
    
    [COLOR="Blue"]If[/COLOR] ActiveCell.Text = ActiveCell.Offset(0, 1)[COLOR="Red"].Text [/COLOR][COLOR="Blue"]Then[/COLOR]
        MsgBox "Correct"
    [COLOR="Blue"]Else[/COLOR]
        MsgBox "Incorrect"
    [COLOR="Blue"]End[/COLOR] [COLOR="Blue"]If[/COLOR]

[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0
Select cell C1, and create a name ( Insert/Name/Define or Formulas/Defined Names/Define name depending on Excel version ), of name, say, FormulaCellToLeft with a definition of:
=GET.CELL(6,Sheet1!B1)
( adjusting the sheet name to suit ... NOTE the cell ref is B1, i.e. one cell to the left of current cell )
Press OK to save the name.

In cell C1 type:
=FormulaCellToLeft=A1
to check the formula in cell B1 against the text contents of cell A1.
 
Upvote 0
Thanks for that, exactly what i wanted

On we go
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,543
Members
452,924
Latest member
JackiG

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