Most accelerometers are usable out of the box. (It is the magnetometers that are difficult to use w/o calibration.)
That said, example 1 looks good until the last line. You need an x-offset which is simply the difference between the x-maximum and x-minimum.
Consider how the coordinates of the X, Y and Z values of an accelerometer would appear if plotted in 3D space. One that is perfectly aligned would appear spherical. But if one of the sensors is more sensitive than the others, the 3D plot might take on an egg shape. You have corrected for this in the first 5 lines of example 1.
Now, if one of the sensors is not centered the 3D plot would be shifted off the 0,0,0 point of the 3D plot. You can correct for that by finding the x-offset, y-offset and z-offset.
You should not need to find the value for 1G. You should not need to find a perfectly flat surface. To calibrate you need to rotate the accelerometer smoothly about its center. Take care not to expose the accelerometer to greater than 1G during calibration. Rotate the accelerometer in a random fashion until you are satisfied that all 3 sensors have experienced their most negative and most positive values.