ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Algebra (https://www.excelbanter.com/excel-worksheet-functions/114640-algebra.html)

Irish3538

Algebra
 
I'm not sure if this is even possible, but is there any way to have a cell
have an algebraic equation where entering a number in a specific cell will
run through the equation and spit the number out in that cell? E.g Cell A1
would be "=x+4" so that when you type "2" into cell A1 it would register 6?
It's for work and I can't have the formula routed through something else so
in order to do it I would need it to come out like that, any ideas?

Barb Reinhardt

Algebra
 
You could create a named range (in my example NAME) that includes the cells
to be evaluated this way.

You could then add the following code to the worksheet. Select the tab
name and then right click to VIEW CODE to get the code in the correct place.

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub
If Not Intersect(Target, Range("Name")) Is Nothing Then
Application.EnableEvents = False
Target.Value = Target.Value + 4
Application.EnableEvents = True
End If

End Sub


"Irish3538" wrote:

I'm not sure if this is even possible, but is there any way to have a cell
have an algebraic equation where entering a number in a specific cell will
run through the equation and spit the number out in that cell? E.g Cell A1
would be "=x+4" so that when you type "2" into cell A1 it would register 6?
It's for work and I can't have the formula routed through something else so
in order to do it I would need it to come out like that, any ideas?


[email protected]

Algebra
 
Irish3538 wrote:
I'm not sure if this is even possible, but is there any way to have a cell
have an algebraic equation where entering a number in a specific cell will
run through the equation and spit the number out in that cell? E.g Cell A1
would be "=x+4" so that when you type "2" into cell A1 it would register 6?


For the example you describe, you would simply put the following in A2
(e.g):

=A1+4

You can also give A1 a name so that you could, in fact, type =x+4.



All times are GMT +1. The time now is 04:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com