Ohm's Law

M

marcus

I need to create a little sheet to calculate different aspects of
Ohm's Law and I need some help to create formulas, please:

B C D E F


5

6

7

8


9

Now, if I enter any value in E5 and F5, I need B6 to give me the
result of F5/E5*E5 calculation. This would be simple for me to do, but
there is more to it:
What if I enter values into D5 and F5 and calculation now is D5*D5/F5?
Then, next formula is: D5/E5. All results in the same cell B6.
In other words, I need the results of different formulas in one cell
B6 depending which values I enter.
Then later I'll need results of different formulas in cells: B7,B8,B9
based on the same principle as the first example.
I hope it's pretty clear,
Can somebody help me, please. Once I get the formula I think I'll
understand it, just don't know how to start.
Thanks in advance

Mark
 
B

Bob Phillips

Maybe something along the lines of

=IF(AND(D5<>"",F5<>""),D5*D5/F5,IF(AND(D5<>"",F5<>""),D5*D5/F5,IF(AND(D5<>"",E5<>""),D5/E5,"")))

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
J

Jason Lepack

I put this together quickly, it doesn't check to make sure that you
have numbers, it assumes that you are going to put numbers in the
cells. For your example that you gave you would put:

=ohmslaw(D5,E5,F5) in cell B6

If you don't have enough numbers then it returns -1.

Public Function OhmsLaw(r1 As Range, r2 As Range, r3 As Range) As
Double
If Not r1.Value = "" And Not r2.Value = "" Then
OhmsLaw = r1.Value / r2.Value
ElseIf Not r1.Value = "" And Not r3.Value = "" Then
OhmsLaw = r1.Value * r1.Value / r3.Value
ElseIf Not r2.Value = "" And Not r3.Value = "" Then
' assuming you mean f5/(e5^2)
OhmsLaw = r3.Value / (r2.Value * r2.Value)
Else
OhmsLaw = -1
End If
End Function

Cheers,
Jason Lepack
 
M

marcus

Maybe something along the lines of

=IF(AND(D5<>"",F5<>""),D5*D5/F5,IF(AND(D5<>"",F5<>""),D5*D5/F5,IF(AND(D5<>"",E5<>""),D5/E5,"")))


Thank you Bob, it works
but I have one more problem and a question.
I'll start with question:
what does it mean: D5<>""
I understand that <> means number different then zero, but "" (?)
Now the problem:
How do I enter this formula in that chain:
in cell B7, C4*E4/Square root of F4*C4

The key was IF(AND(
I knew I had to use IF but then I got stuck...

Thanks again

Mark
 
J

Jason Lepack

ACtually D5<>"" means this:

It returns TRUE if the text is D5 is <> (Greater Than or Less Than)
""(Empty string).
 
M

marcus

I put this together quickly, it doesn't check to make sure that you
have numbers, it assumes that you are going to put numbers in the
cells. For your example that you gave you would put:

=ohmslaw(D5,E5,F5) in cell B6

If you don't have enough numbers then it returns -1.

Public Function OhmsLaw(r1 As Range, r2 As Range, r3 As Range) As
Double
If Not r1.Value = "" And Not r2.Value = "" Then
OhmsLaw = r1.Value / r2.Value
ElseIf Not r1.Value = "" And Not r3.Value = "" Then
OhmsLaw = r1.Value * r1.Value / r3.Value
ElseIf Not r2.Value = "" And Not r3.Value = "" Then
' assuming you mean f5/(e5^2)
OhmsLaw = r3.Value / (r2.Value * r2.Value)
Else
OhmsLaw = -1
End If
End Function

Cheers,
Jason Lepack


Thank you all for your help

Mark
 
K

KC Rippstein

=C4*E4/(F4*C4)^0.5

Thank you Bob, it works
but I have one more problem and a question.
I'll start with question:
what does it mean: D5<>""
I understand that <> means number different then zero, but "" (?)
Now the problem:
How do I enter this formula in that chain:
in cell B7, C4*E4/Square root of F4*C4

The key was IF(AND(
I knew I had to use IF but then I got stuck...

Thanks again

Mark
 
B

Bob Phillips

Weird way of saying, if D5 is NOT blank

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



ACtually D5<>"" means this:

It returns TRUE if the text is D5 is <> (Greater Than or Less Than)
""(Empty string).
 
B

Bob Phillips

Should that be C6 etc?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top