offset correction for analog input

Is your problem an offset or scaling error? Is it a constant offset, or does it change with the analog value? Input 0v and 3.3v. Is the offset the same with both?

If it is offset, add or subtract the offset from the final value.
If it is scaling, change the 1024 value to adjust the scaling factor.