Module 3 Assignments
Module 3 Assignments
Objective: To understand how to leverage ChatGPT for various tasks related to Excel
Task: You are given the sales data of a company in different regions over a period of time.
The data is provided in the excel format. Download the data set and use ChatGPT to
generate the formulas for the following tasks. Put the formulas at relevant places and
verify if the desired results are generated.
1. A formula to calculate the moving average of the Total Sales over a 7-day period.
2. A formula to categorize sales into different regions automatically.
3. A formula to identify sales anomalies (values significantly higher or lower than the
average).
Solutions:
Task 1: Moving Average of Sales Data
Objective: Calculate the moving average of the Total Sales over a 7-day period.
Solution: Use the following formula in Excel to calculate the 7-day moving average for Total
Sales. This formula assumes the Total Sales values are in column G, starting from row 2:
=AVERAGE(G2:G8)
Drag this formula down to calculate the moving average for the entire dataset.
Task 2: Categorize Sales into Different Regions Automatically
Assuming the Region values are in column C, you can use a CHOOSE function to categorize
the sales data. For example:
less
Copy code
This formula matches the region name to the array and assigns a corresponding category.
=AVERAGE(G2:G301)
● Standard Deviation:
=STDEV.P(G2:G301)
Then, use the following formula to flag anomalies (values more than 2 standard deviations
away from the mean). This formula assumes the average and standard deviation are in cells
H1 and H2, respectively:
Objective:
To learn how to use Debugcode.ai for identifying and fixing bugs in Python code.
1. Tasks:
Please read the Python code to find some statistical values from a given data. The code has
some syntax based and formula based errors. Use DebudCode.ai to identify the following
possible errors in the code.
1. Incorrect calculation of variance.
2. Inaccurate standard deviation calculation.
def calculate_statistics(data):
total = sum(data)
mean = total / len(data)
variance = sum((x - mean) ** 2 for x in data) / len(data) - 1
std_dev = variance ** 0.5
return mean, variance, std_dev
def process_data(data):
mean, variance, std_dev = calculate_statistics(data)
print(f"Mean: {mean}")
print(f"Variance: {variance}")
print(f"Standard Deviation: {std_dev}")