I have a shapefile that I'm trying to produce a specific label for using VBScript. I'm using the values in the [MEASURE] field.

"PI: " & INT([MEASURE]/100) & "+" & (ROUND(([MEASURE] - INT([MEASURE]))*100,2))

MEASURE = 33598.2794

Current Output = PI: 335+27.94

Desired Output = PI: 335+98.28

How do I change the VBScript I currently have In ArcMap to produce the desired output?


Subtract the INT([MEASURE]/100) value, multiplied by 100, from the MEASURE to leave the remaining 98.28

Use Advanced label expression

Function FindLabel ( [MEASURE] )
 DIM leftval, rightval
 leftval = INT([MEASURE]/100)
 rightval = ROUND([MEASURE]-(leftval*100),2)

 FindLabel = leftval & "+" & rightval
End Function

enter image description here

Basically subtracting 33500 from 33598.28, leaving 98.28 which is then appended to the label

enter image description here

Can also do it in a simple expression but it's a little harder to read and debug

INT([MEASURE]/100) & "+" & ROUND([MEASURE]-(INT([MEASURE]/100)*100),2)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.