Urgent help with nestled condition is needed

  • Thread starter Thread starter farsta_online
  • Start date Start date
F

farsta_online

Hi, please help me with this

1) check if D6/100 > 1,5

2) if 1 true: check if D6/100 < 25

3) if 2 false: check D6/250>1,5

4) if 3 true: check D6/250<25

5) if 4 false check D6/500 >1,5

6) if 1 false: then B30= "can't use"

7) if 2 true: B16 = 100

8) B30 =(B16*60/((B2*F2)/(1*F2)))

9) If 4 true: B16 = 250

10) B30 =(B16*60/((B2*F2)/(1*F2))

11) If 5 true: B16=500

12) B30 =(B16*60/((B2*F2)/(1*F2))



Any help we´ll be appreciated

/Peter
 
Most of this question was answered the first time you asked it although you
don't show an upper constraint for 500 this time.


=if(and(D6/100>1.5 said:
1.5,500,"can't use")))

=if(isnumber(B16),(B16*60/((B2*F2)/(1*F2)),"can't use")
 
I like a challenge, so I'll give it a go:

TestVar1 = (Range("D6").Value/100)
TestVar2 = (Range("D6").Value/250)
TestVar3 = (Range("D6").Value/500)

If TestVar1 > 1,5 Then
If TestVar1 < 25 Then
Range("B16").Value = 100
Else
If TestVar2 > 1,5 Then
If TestVar2 < 25 Then
Range("B16").Value = 250
Else
If TestVar3 > 1,5 Then
Range("B16").Value = 500
End If
End If
End If
End If
Range("B30") = (Range("B16") * 60 / _
((Range("B2") * Range("F2")) / (1 * Range("F2"))))
Else
Range("B30").Value = "can't use"
End If

YIKES! Hope I got it...
 
Tom,
you wrote: "Most of this question was answered the first time you
asked....."
Yes but the excel (as I wrote in my answer) didn´t accepted your
suggestion
/Peter
 
The formula works fine in Excel for me - and I see no post in that thread
where you responded at all. You should stay in a thread once you start
one.
 
Why "thanks anyway" - the formula provided represents the situation you
described. It is taken from an excel cell (B16) where it is working very
well. If it doesn't work for you, did you change 1.5 to 1,5 so it matches
your regional settings?
 
Sorry Tom for my bad english - It wasn´t my meaning to affend you, I´m
very grateful for you help and support.

Anf yes I tried with both 1.5 and 1,5...
Can my truble depends on that my excel is "swedish speeking" and your
formula is in english?
/Peter
 
You would have to change IF and AND to the swedish equivalent.

You can try this

Sub MakeFormula()
Dim sForm as String
sForm = "=if(And(D6/100>1.5,D6/100<25),100,if(And" & _
"(D6/250>1.5,D6/250<25),250,if(D6/250" & _
"1.5,500,""can't use"")))"
Range("B16").Formula = sForm
End Sub

Paste that into a general module and run it.

It should put in a formula in B16 of the active sheet that your excel can
work with. You don't need to make any changes to the above - VBA should
work with the English version of the formula.
 
Tom (and others who are reading this tread):
the problem was that "my excel" want´s ";" instead of ","

Thanks for al your help
/Peter
 

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

Back
Top