I am having a problem with formatting text in a label expression using VBscript.
Here is my label expression:
Function FindLabel ([Mean], [Count])
if ([Mean] < 1) then
FindLabel = [Count] & vbCrLf & vbCrLf & "< 1" & vbCrLf & " "
Else
FindLabel = "<FNT size='3'>" & [Count] & vbCrLf & vbCrLf& "</FNT>" & "<BOL>" & Round([Mean],1) & "</BOL>" & vbCrLf & " "
end if
End Function
It results with this: the label on the left is what I want.
I understand that the cells on the right are formatted as they are because of the < formatting tags> but if I edit the label expression to have the tags on both sides of the Else statement like this:
Function FindLabel ([Mean], [Count])
if ([Mean] < 1) then
FindLabel = "<FNT size='3'>" & [Count] & vbCrLf & vbCrLf& "</FNT>" & "<BOL>" & "< 1" & "</BOL>" & vbCrLf & " "
Else
FindLabel = "<FNT size='3'>" & [Count] & vbCrLf & vbCrLf& "</FNT>" & "<BOL>" & Round([Mean],1) & "</BOL>" & vbCrLf & " "
end if
End Function
It results with this:
Is there some way around putting tags on either side of the Else statement?
The symbols "<" , ">", and "&" are special characters and are not valid in your text if formatting tags are used. Use the equivalent character entity codes & and < instead.... You can find other special entity character codes here: HTML 4 Entities
"<FNT size='3'>" & [Count] & vbCrLf & vbCrLf& "</FNT>" & "<BOL>" & "<1" & "</BOL>" & vbCrLf & " "
Thank you!
I replaced the "<1" with "<1" and that fixed it.