View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default Lookup Multiple text in String

Simply repeat the function
e.g

Function Server(pVal As String, pVal2 As String) As String

If InStr(pVal, "DL380") AND InStr(pVal2, "HP") Then
Server = "HP Proliant DL380"

ElseIf InStr(pVal, "DL340") AND InStr(pVal2, "HP") Then
Server = "HP Proliant DL340"

ElseIf InStr(pVal, "DL580") AND Instr(pVal2, "HP") Then
Server = "HP Proliant DL580"

Else
ServerType = "Hardware Not Defined"
End If

End Function

--
Les Torchia-Wells


"okelly" wrote:


Hi folks
Can you provide me the correct syntax for the "AND" command below.
ie If "HP" is found in one field and "DL380" is found in another field
then this record must relate to a "HP Proliant DL380" server etc
etc...

Thanks
Conor



Code:
--------------------


Function Server(pVal As String, pVal2 As String) As String

If InStr(pVal, "DL380") AND (pVal2, "HP") Then
Server = "HP Proliant DL380"

ElseIf InStr(pVal, "DL340") AND (pVal2, "HP") Then
Server = "HP Proliant DL340"

ElseIf InStr(pVal, "DL580") AND (pVal2, "HP") Then
Server = "HP Proliant DL580"

Else
ServerType = "Hardware Not Defined"
End If

End Function




--------------------


--
okelly
------------------------------------------------------------------------
okelly's Profile: http://www.excelforum.com/member.php...o&userid=36708
View this thread: http://www.excelforum.com/showthread...hreadid=565973