Determining the sample size in SPC can be done through formulas that are based on statistical theory and assumptions. These formulas can help you estimate the sample size needed to reach a specific level of confidence, precision, or power in your SPC charts and analysis. For example, if you want to use an X-bar and R chart to monitor the mean and range of a process, the formula n = (Zα/2 * σ / E)^2 can be used to calculate the sample size, where n is the sample size, Zα/2 is the critical value for a given confidence level, σ is the standard deviation of the process, and E is the margin of error or the maximum allowable difference between the sample mean and the true mean. However, utilizing formulas can have some limitations and challenges such as not knowing values of parameters such as σ and having to estimate them from historical or pilot data which can introduce uncertainty and bias. Furthermore, assumptions may need to be made about the distribution and behavior of the process which may not hold true in reality. Additionally, adjustments may need to be made for different types of SPC charts and statistics such as attribute charts or non-normal data. Other factors that can affect sample size such as frequency of sampling, subgroup size, process stability, and type of variation must also be taken into account.