IF formula

J

John C Williams

Hi

In the days of Qbasic (yes that long ago) I used to be able to type
something similar to:-
Enter A
IF A=<999 then PRINT "Too low"
Enter A
If A=>1000 AND IF A=<3999 then PRINT "Linz"
IFA=>4000 AND IF A=<5999 then PRINT "Vienna"
and so on.

It's a little program to establish the nearest airport to a given post code
in a given country.

I can't figure out how to do this in Excel.

Any help appreciated.

TIA

John

--



_______________________
Check out Xtreme Release
http://xtreme.nlpc.co.uk
 
T

Trevor Shuttleworth

John

for Enter A, use A = INPUTBOX and for PRINT, use MSGBOX. Look up the
details in the Help

It would look something like:

Sub Airports()
a = InputBox("Enter the distance", "Distance", 0)
If a <= 999 Then MsgBox "Too low"
a = InputBox("Enter the distance", "Distance", 0)
If a >= 1000 Then If a <= 3999 Then MsgBox "Linz"
If a >= 4000 Then If a <= 5999 Then MsgBox "Vienna"
End Sub

Regards

Trevor
 
J

John C Williams

Thanks, I'll try that
John
Trevor Shuttleworth said:
John

for Enter A, use A = INPUTBOX and for PRINT, use MSGBOX. Look up the
details in the Help

It would look something like:

Sub Airports()
a = InputBox("Enter the distance", "Distance", 0)
If a <= 999 Then MsgBox "Too low"
a = InputBox("Enter the distance", "Distance", 0)
If a >= 1000 Then If a <= 3999 Then MsgBox "Linz"
If a >= 4000 Then If a <= 5999 Then MsgBox "Vienna"
End Sub

Regards

Trevor
 

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

Top