Zum Hauptinhalt gehen

Suche

Suche

Find Percentage Of Two Values (Div/zero Errors!)

Kommentare

3 Kommentare

  • Avatar
    Legacy Poster

    Issue solved by using a multiline script with variables.

    0
  • Avatar
    Legacy Poster

    How did you fix this? I'm trying to round to the nearest 10 and calculate the difference.

    0
  • Avatar
    Legacy Poster

    Hi Rod,

    I used the following code block as a multi-line script and it seems to work ok:

     

    If (CompPrice <>0) then
        If(CDbl(CompPrice - Price )>=CDbl(CompPrice*0.15)) then
            x = (100-((100/CompNoZero)*Price))
            y = (Int(x/10))*10
            If(y < (x-5)) then
                Value = " Save over " + CStr(y+5)+ "% "    
            else
                Value = " Save over " + CStr(y)+ "% "    
            End If
        else
            Value = ""
        End If

    else
        Value = ""
    End If

     

    There is probably a more elegant way of doing it, but this works for me. It is also adding in a text string to display as a saving but you could just remove that. Hope that helps!
     

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.