View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default problem with 'IF'

Depends on where you want the result and whether C1 is a variable or a range
reference.

Select Case Range("C1").value
Case "7-14"
msgbox "7"
Case "8-20"
msgbox "12"
End Select

--
Regards,
Tom Ogilvy



" wrote:

How can I create in Excel function like this:

IF (C1 == "7-14"){
cout << "7";
}
else if (C1 == "8-20"){
cout << "12";
}