AnsweredAssumed Answered

Multiple line return of multiple VB if then statements

Question asked by granthay on Apr 19, 2017
Latest reply on Apr 20, 2017 by tkowal

I've been tasked with creating labels for some monitoring wells, the labels are the well name and then a list of a years worth of sulfate concentrations in each well, this is easy enough to do, however they want the text to be red if the sulfate value is above a certain concentration. I wrote a vbscript block with multiple if then statements to try to achieve this, and while it shows no errors, it only returns the results of the last if/then statement. What am I missing? I imagine it may need some kind of instruction to return each individual statement? 

 

Function FindLabel ([Well_Nme], [Total_Sulfate_3_16], [Total_Sulfate_6_16], [Total_Sulfate_9_16], [Total_Sulfate_12_16])
FindLabel="<BOL><UND>"&[Well_Nme]&"</UND></BOL>"
if ( [Total_Sulfate_3_16]=>250000) then
FindLabel= "<CLR red='255'>"& [Total_Sulfate_3_16] &"</CLR>"
elseif ([Total_Sulfate_3_16] <250000) then
Findlabel = [Total_Sulfate_3_16]
end if
if ([Total_Sulfate_6_16] =>250000) then
FindLabel = "<CLR red='255'>"& [Total_Sulfate_6_16] &"</CLR>"
elseif ( [Total_Sulfate_6_16] <250000) then
Findlabel = [Total_Sulfate_6_16]
end if
if ( [Total_Sulfate_9_16] =>250000) then
FindLabel = "<CLR red='255'>"& [Total_Sulfate_9_16] &"</CLR>"
elseif ( [Total_Sulfate_9_16] <250000) then
Findlabel = [Total_Sulfate_9_16]
end if
if ( [Total_Sulfate_12_16]=>250000) then
FindLabel = "<CLR red='255'>"& [Total_Sulfate_12_16] &"</CLR>"
elseif ( [Total_Sulfate_12_16]<250000) then
Findlabel = [Total_Sulfate_12_16]
end if
End Function

Outcomes