Determine the third octet of an IP address based on user entered site number
Let's start with a table of inputs and outputs, because it may not be exactly the same as what you expect from your script.  The first column is the input range, the other column is the transformation applied for those inputs.

0000-0255       self
0256-0399       last2
0400            undefined
0401-0499       -300
0500            undefined
0501-0799       last2
0800-1201       undefined
1202            last3
1203-4999       undefined
5000-5255       last3
5256-5399       last2
5400-5500       undefined
5501-5999       last2
6000+           same as 5000-5999


The best way to manage these cases is with a data structure.  A switch statement can work too but there's going to be a lot of repetition, and you really want something that lets you focus on the data.  

In this version, the ranges are an array of arrays.  Each inner array is a lower bound, an upper bound, and a script block that transforms input to output.  As a special case, a negative result from the script block means "restart the conversion with this new value (after making it positive)"—this lets us reuse the low patterns for most of 5000-5999, and then reuse the 5000-5999 pattern for 6000-9999.

We simply traverse the array looking matches, and apply the transforms from matching rows. (There's only ever one matching row per call to convert, in this example, but the code allows overlapping ranges; matching transforms will apply in order).

$ranges = @(
    @(    0,  255, { $_ }                  ),
    @(  256,  399, { $_ % 100 }            ),
    @(  401,  499, { $_ - 300 }            ),
    @(  501,  799, { $_ % 100 }            ),
    @( 1202, 1202, { $_ % 1000 }           ),
    @( 5000, 5399, { -($_ % 1000) }        ), # redo using last 3 digits
    @( 5501, 5999, { -($_ % 1000) }        ),
    @( 6000, 9999, { -($_ % 1000 + 5000) } )  # redo using 5000 + last 3
)

$convert = {
    $_ = [int]$args[0]
    $out = -1
    foreach ($range in $ranges) {
        if ($_ -ge $range[0] -and $_ -le $range[1]) { 
            $out = &amp; $range[2] 
            # negative result means re-do the conversion with a new value
            if ($out -lt 0) { $out = &amp; $convert ($out * -1) }
        }
    }
    return $out
}

$site = Read-Host 'enter the site code: '
$octet = &amp; $convert $site
if ($octet -ge 0) {
    echo $octet
} else {
    echo "error - $site has no defined octet"
}