⚡0 XP🔥0

AI for Excel, Data and Coding

Lesson 3 of 4 ⏱ 4 min read ❓ 4-question quiz

Get Excel formulas and pivot steps explained, analyse a CSV with AI, write and debug Python and SQL with an assistant, and the habits that keep AI-written code correct.

Excel with AI#

Describe your sheet - column letters, what's in them - and what you want:

Prompt: SUMIFS

My sheet has: column A = Date, B = Region, C = Product, D = Sales (Rs). Write a formula to total Sales for Region "Indore" and Product "Tussin" in March 2026. Explain each part of the formula.

A good answer looks like:

=SUMIFS(D:D, B:B, "Indore", C:C, "Tussin", A:A, ">="&DATE(2026,3,1), A:A, "<"&DATE(2026,4,1))

Other useful asks:

  • "Explain this formula in simple words: =IFERROR(XLOOKUP(E2, Products!A:A, Products!C:C), "Not found")"
  • "Give me the steps to make a pivot table of monthly sales by region, with a chart."
  • "My VLOOKUP returns #N/A for some codes that clearly exist. What could cause this?" (Answer: extra spaces, numbers stored as text...)
  • "Write a formula to extract the PIN code (last 6 digits) from an address in A2."
Tip

Test every AI formula on a few rows where you already know the answer, including tricky ones - blanks, zeros, text in a number column.

Data analysis with AI#

Many assistants can read an uploaded CSV or Excel file and run Python on it. Even without that, you can paste a small sample and ask for the code to run yourself:

I have a CSV sales.csv with columns: order_date, region, product, qty, amount.
Write pandas code to:
1. show total amount by month and region,
2. find the top 5 products by amount,
3. plot monthly total amount as a line chart.
Explain each step briefly.

Then run it yourself (for example in the Vindhyaedu playground or Python course) and check the totals against a number you trust, such as the accounts figure.

Common Mistake

Don't upload customer names, phone numbers, salaries or other personal data to a public AI tool. Remove or mask those columns first, or use the tool your company has approved.

Writing code#

AI is a strong pair-programmer for:

  • writing a first version of a function or script,
  • converting code between languages (Python → JavaScript),
  • writing SQL from a plain-English question,
  • adding comments, docstrings and tests,
  • explaining unfamiliar code.
Prompt: SQL

Tables: customers(id, name, city), orders(id, customer_id, order_date, amount). Write a SQL query for the top 5 cities by total order amount in 2025, with the number of customers in each city. Use SQLite syntax and explain the JOIN.

Debugging#

Give the AI everything it needs:

This Python code should print the average of the marks, but I get an error.

marks = input("Enter marks: ").split()
print(sum(marks) / len(marks))

Error:
TypeError: unsupported operand type(s) for +: 'int' and 'str'

Explain why the error happens and show the fixed code.

The AI will explain that split() gives strings, so they must be converted with map(int, ...) first - and now you understand the bug, not just the fix.

हिंदी में समझें

AI से code ठीक करवाते समय पूरा error message, आपका code, और आप क्या चाहते थे - तीनों दें। फिर सिर्फ़ fixed code copy न करें - पूछें "यह error क्यों आया?"। ऐसे हर bug से आप कुछ नया सीखते हैं।

Learning to code with AI (without cheating yourself)#

  1. Try first - spend 10-15 minutes on the problem yourself.
  2. Ask for a hint, not the answer - "Give me a hint for this exercise, don't write the code."
  3. Ask for explanations - "Explain this solution line by line."
  4. Rewrite it yourself from memory, then run and test it.
  5. Ask it to quiz you - "Give me 3 practice problems on loops, easy to hard."

Interviewers and exams test what you can do. Use AI as a tutor - Vindhya AI on this site is built for exactly that.

Habits for AI-written code#

  • Read and understand every line before you use it.
  • Run it and test normal cases and edge cases (empty input, zero, very large values).
  • Check that functions and libraries it uses really exist - AI sometimes invents them.
  • Never paste API keys, passwords or private company code into public tools.
  • Keep your code in Git so you can undo bad changes.

Summary#

  • Describe your sheet precisely to get correct Excel formulas; test them on known rows.
  • Ask for pandas/SQL code, run it yourself, and verify totals.
  • For debugging, give code + exact error + expected result, and ask why.
  • Learn with hints and explanations, not copy-paste.

Quick Quiz

Q1.

AI gives you an Excel formula. What is the best way to trust it?

Q2.

When asking AI to fix an error, what should you include?

Q3.

You are learning to program. How should you use AI?

Q4.

An AI-written SQL query runs without errors. Is it correct?