Automation and Toil Reduction Questions
Deciding what manual, repetitive work is worth automating and proving it paid off. Covers identifying and inventorying toil, scoring and prioritizing automation candidates, break-even and ROI arithmetic including maintenance cost, choosing an automation approach (robotic process automation, scripts, no-code tools, rules engines, ML-assisted triage, self-service) and migrating legacy spreadsheet or macro processes, when not to automate, safeguards and governance for automation that touches production or business-critical processes (dry-run, approvals, audit trail, ownership, rollout and rollback), finding opportunities through ticket data or process-discovery analysis, measuring automation health and impact (including diagnosing regressions and attributing impact), cataloguing existing automations, making the business case to leadership, and managing the people side (adoption, reskilling, stakeholder concerns). Applies to operations, data and business-process work alike. Excludes writing the automation itself (scripts, infrastructure-as-code, pipelines, orchestrator internals), the definition of toil as reliability doctrine, and incident response mechanics.
A legacy AP system automates 60% of invoice matching, but exceptions remain manual and account for 70% of processing time. Propose a data-driven plan (including analytics, potential ML or RPA, process redesign, and change management) to reduce exception handling cost by 50%. Specify data requirements, pilot metrics, estimated implementation cost, and how you would calculate ROI.
Sample Answer
The idea in plain words
In accounts payable (AP, the process of checking and paying supplier invoices), invoice matching compares an invoice with the purchase order (PO, the buyer's order to the supplier, with the quantity and price agreed) and the goods receipt (the record that the goods actually arrived and how many). An exception is an invoice that fails to match (wrong price, wrong quantity, missing purchase order) and lands in a person's queue. Here 60% of invoices match automatically but the exceptions, the other 40%, take 70% of the processing time. So the money is in the exceptions, and "cut exception cost by 50%" is achieved by three levers used together: prevent exceptions from arising, resolve the simple ones by rule, and make the people handling the rest faster. Technology is chosen per lever after the exceptions have been analysed, not before: prevention and simple rules carry the most weight, and machine learning and robotic process automation are optional additions for the cases those leave behind.
Step 1: Size the problem (assumptions stated)
Assume 500,000 invoices a year and a total AP labour cost of USD 3,000,000 a year.
- Auto-matched: 60% x 500,000 = 300,000 invoices. Exceptions: 40% x 500,000 = 200,000.
- Cost of exceptions = 70% x 3,000,000 = USD 2,100,000, so USD 2,100,000 / 200,000 = USD 10.50 per exception.
- Cost of clean invoices = 30% x 3,000,000 = USD 900,000, so USD 900,000 / 300,000 = USD 3.00 per invoice.
- An exception costs 10.50 / 3.00 = 3.5 times a clean invoice.
The 50% target means taking USD 1,050,000 a year out of the USD 2,100,000. First verify the "70% of time" claim with time data, because everything below scales with it.
What one exception looks like
Suppose the PO was for 10 units at USD 100, the goods receipt shows 10 units arrived, and the supplier's invoice bills 12 units at USD 104. A tolerance policy is the rule set that says how far apart the documents may be before a person must look; assume this one auto-approves a unit price up to 5% over the PO and never a quantity above what was received:
# Three-way match: purchase order (what we ordered), goods receipt (what arrived), invoice (what we are billed).
po = {"qty": 10, "unit_price": 100.00}
receipt = {"qty": 10}
invoice = {"qty": 12, "unit_price": 104.00}
PRICE_TOLERANCE = 0.05 # tolerance policy: auto-approve up to 5% over the ordered unit price
price_gap = invoice["unit_price"] / po["unit_price"] - 1
print(f"PO value : {po['qty'] * po['unit_price']:.2f}")
print(f"invoice value : {invoice['qty'] * invoice['unit_price']:.2f}")
print(f"price gap : {price_gap:.1%} -> {'within' if price_gap <= PRICE_TOLERANCE else 'outside'} tolerance")
print(f"quantity : billed {invoice['qty']}, received {receipt['qty']} -> "
f"{'ok' if invoice['qty'] <= receipt['qty'] else 'EXCEPTION'}")
extra = max(invoice["qty"] - receipt["qty"], 0)
print(f"billed but not received: {extra} units = {extra * invoice['unit_price']:.2f}")
# The pilot-audit claim: n clean audits when the true error rate is 1%.
print(f"0.99^299 = {0.99 ** 299:.4f}")
# Discounting: present value at an illustrative 10% a year.
net = [-39_750, 971_000, 971_000]
pv = sum(x / 1.10 ** (t + 1) for t, x in enumerate(net))
print(f"3-year net {sum(net):,} undiscounted, {pv:,.0f} discounted at 10%")
Output:
PO value : 1000.00
invoice value : 1248.00
price gap : 4.0% -> within tolerance
quantity : billed 12, received 10 -> EXCEPTION
billed but not received: 2 units = 208.00
0.99^299 = 0.0495
3-year net 1,902,250 undiscounted, 1,495,870 discounted at 10%
Reading it: the price is 4% over the PO (104 / 100 - 1), inside the 5% tolerance, so the price would be approved by rule. The quantity fails: 12 billed against 10 received, so 2 units worth USD 208 are billed but not received, and the invoice lands in a person's queue. The handler either asks the supplier for a credit note (a document from the supplier reducing what is owed) or waits for the missing goods to be received. Paying the invoice twice by mistake is a duplicate payment, the costly error that automatic approval must never create. The last two printed lines are used in Steps 4 and 5.
Step 2: Data requirements
| Data | Purpose |
|---|---|
| Invoice headers and lines, purchase orders, goods receipts | Reproduce the matching and see why it failed |
| Exception reason code, created and resolved timestamps, handler, actions taken | Pareto of causes (a ranking by count and cost), touch time and age |
| Time spent per exception (sampled time study if the system does not record it) | Cost per exception by type |
| Resolution outcome and any later reversal, credit note or duplicate payment (a repeat payment of one invoice) | Labels for rules or a model, and the cost of wrong decisions |
| Supplier master, price lists, tolerance policy | Root causes (stale prices) and the rules for auto-resolution |
Analytics first: rank exception causes by count x cost; typically a few causes carry most of the cost. Do not assume that here; read it from the data.
Step 3: Interventions mapped to the levers
- Prevent (process redesign). Fix causes at source: update price lists, require purchase order numbers on supplier invoices, send suppliers structured invoices, correct receiving delays. No technology is needed for much of this, and it removes the exception rather than making it cheaper.
- Resolve by rule. Mismatches inside an agreed tolerance (a price difference below a stated amount, for example) are approved automatically and logged. Start with rules a finance controller signs off.
- Assist the rest. Machine learning (a model trained on past resolutions) can suggest the likely cause and fix, such as the probable purchase order, and rank the queue by value and age. Robotic process automation (RPA, software that imitates clicks and typing) only fits steps that have no interface, such as copying data between two systems.
Where the 35% in the plan below could come from (assumed times, to be replaced by a time study): a handler spends 20 minutes on an average exception. Finding the matching PO takes 8 minutes and a suggestion from a model that ranks likely POs cuts it to 3 (saves 5); writing the supplier query takes 5 minutes and a pre-drafted message cuts it to 3 (saves 2); reviewing and approving takes 7 and is unchanged. The new time is 20 - 5 - 2 = 13 minutes, a reduction of 7 / 20 = 35%. If the time study finds the search step is 3 minutes already, the gain is smaller and the plan must be re-run.
Worked reduction plan (assumed rates):
| Lever | Calculation | Saving per year (USD) |
|---|---|---|
| Prevent 20% of exceptions: 40,000 become clean invoices | 40,000 x (10.50 - 3.00) | 300,000 |
| Auto-resolve 40,000 more at USD 1.00 each | 40,000 x (10.50 - 1.00) | 380,000 |
| Faster handling of the remaining 120,000 (200,000 - 40,000 - 40,000), cost down 35% | 120,000 x 10.50 x 0.35 | 441,000 |
| Gross saving | 1,121,000 | |
| Cost of wrong auto-resolutions: 1% of 40,000 = 400 errors at USD 150 each to recover | 400 x 150 | -60,000 |
| Net saving | 1,121,000 - 60,000 | 1,061,000 |
Prevention and rules together supply 300,000 + 380,000 = 680,000 of the 1,121,000 gross saving (60.7%). Net reduction = 1,061,000 / 2,100,000 = 50.5%. The target is met, but with a margin of only USD 11,000, and that should be said plainly: the plan depends on the error rate of the automatic approvals staying near 1%, and on the 35% handling gain. At 2% errors the cost doubles to 120,000 and net falls to 1,001,000, which is 47.7% and misses the target. This is why precision (how many automatic decisions are right) is a pilot metric, not an afterthought.
Step 4: Pilot metrics
Run a pilot in one business unit or one supplier group for about 8 weeks, in shadow mode first (the system proposes, a person decides, and both are compared), then live on low-value invoices.
- Exception rate (baseline 40%) and the share by cause.
- Auto-resolution rate and precision: share of automatic decisions that a reviewer agrees with. Audit a sample: 299 audited automatic decisions with zero errors show the error rate is below 1% with 95% confidence. The reasoning: if the true error rate were 1% or worse, each audited decision would be correct with probability at most 0.99, so 299 correct ones in a row would happen with probability at most 0.99^299 = 0.0495 (printed above), under 5%. A clean record that long would be unlikely for an automation that bad, and fewer samples prove less.
- Cost per exception (baseline USD 10.50) from time data, and handling time per exception.
- Money at risk: overpayments, duplicate payments, and reversed payments per month.
- Cycle time from invoice receipt to payment, and supplier complaints about late payment.
- Guardrails: a value ceiling above which a person always approves, a log of every automatic decision, and a one-step way to switch back to manual.
Step 5: Cost and ROI
Assumed costs: build 2,000 hours x USD 100 per hour = USD 200,000, change management and training USD 60,000 (one-off, total 260,000); running cost USD 50,000 for tooling plus USD 40,000 for support, so USD 90,000 a year, half of which (45,000) falls in year 1 as go-live is mid-year. Assume year 1 delivers 25% of the net saving (ramp): 0.25 x 1,061,000 = 265,250.
| Year | Benefit (USD) | Cost (USD) | Net (USD) |
|---|---|---|---|
| 1 | 265,250 | 260,000 + 45,000 = 305,000 | -39,750 |
| 2 | 1,061,000 | 90,000 | 971,000 |
| 3 | 1,061,000 | 90,000 | 971,000 |
| Total | 2,387,250 | 485,000 | 1,902,250 |
Payback: the year-1 shortfall of 39,750 is repaid by monthly net benefit of 971,000 / 12 = 80,917 in 0.49 months of year 2, so about month 13. The figure ignores discounting and assumes the exception mix does not change; both should be stated when presenting it. Discounting reflects that money received later is worth less than money today: each year's net is divided by (1+r)t for a discount rate r and year t. At an illustrative 10% a year the three-year net of 1,902,250 becomes 1,495,870 (printed above), still strongly positive.
Where the inputs come from in a real AP team. Cost per exception: a sampled time study of handlers multiplied by their loaded hourly cost. The 1% error rate and USD 150 per error: the audit sample of automatic decisions, and the finance records of reversed or recovered payments (handler hours plus supplier contact). The 25% year-1 ramp: the pilot's adoption curve, read as the share of eligible invoices actually flowing through the new rules by the end of the pilot. Replace every assumed rate with the measured one before the business case goes to approval.
Step 6: Change management
Involve the AP team in the exception analysis (they know the causes), agree the tolerance rules with finance control and internal audit, communicate what happens to the time freed, train handlers for the harder exceptions that remain, and brief key suppliers on the new invoice requirements.
Judgement
I would start with analytics and the prevent lever, since it is cheapest and removes work for good, then rules, then machine learning only if the data shows judgement-heavy exceptions that rules cannot cover. If the pilot shows precision below the level that keeps the net saving above the target, I would tighten the auto-approval scope rather than accept the errors.
Common mistakes
- Starting with a tool before the cause analysis.
- Counting gross savings and omitting the cost of wrong automatic approvals.
- Taking "70% of time" as the saving available, instead of the share removable.
- Skipping the audit trail for automatic payments.
Running the code
Python 3.12, standard library only. Save the program as match.py and run python match.py.
A junior analyst applies the same transformations to spreadsheet exports every week before loading them into a dashboard tool. What automation options would you consider, and how would you choose among them for someone with limited coding experience?
Sample Answer
The idea in plain words
Toil is manual, repetitive work that follows the same steps each time and gives no lasting value. Redoing the same transformations on a spreadsheet export every week is toil. The best answer is a ladder of options, from "remove the step" to "write a program", and you pick the lowest rung that is reliable and that the analyst can maintain without help. For someone with limited coding experience, the deciding factor is usually not what runs fastest but what the analyst can see, change and fix when it breaks.
The options, lowest effort first
| Rung | Option | Coding needed | Typical fit |
|---|---|---|---|
| 1 | Remove or move the step: ask the source system to export in the clean shape, or let the dashboard tool do the transformation on load | None | The mess is created upstream, or the dashboard tool already has a data-prep feature |
| 2 | Record the steps in a query tool built into the spreadsheet (for example Power Query in Excel, or the import and formula features of a spreadsheet product) and refresh | Almost none; steps are clicked, then replayed | Same cleaning steps each week: filter rows, rename columns, change types, merge two files |
| 3 | A recorded macro or a scripting feature of the office suite | Low; recorded code that can be edited later | Steps that touch the spreadsheet screen itself (formatting, copy to a template) |
| 4 | A no-code workflow tool (you connect blocks such as "when a file arrives", "clean it", "save it here" instead of writing code) that picks up the file and writes the result | Low; drag and connect | The trigger is an event (a file arrives in a folder) and the output goes to another system |
| 5 | A short script in a language such as Python, kept in version control (a system such as git that stores every saved version of a file, who changed it and why, so a bad change can be undone) | Real coding | Logic too complex for clicks, large files, or a team that will grow this into a pipeline |
| 6 | A request to a data engineering team for a scheduled pipeline | None for the analyst, but a queue wait | Many people need the same cleaned data, or the data is sensitive and must be governed |
What rung 2 looks like. A query tool such as Power Query lists each action you clicked as a named step, and replays the list from the top on every refresh. An illustrative list of applied steps for a weekly export:
- Source: the file
weekly_export.xlsxin the shared folder - Removed Top Rows: the first 2 rows (a title and a blank line)
- Promoted Headers: the next row becomes the column names
- Renamed Columns:
Cust NmbecomesCustomer - Changed Type:
Amountto decimal number,Dateto date - Filtered Rows: drop rows where
Amountis empty
The analyst can click any step to see the data at that point, delete or reorder steps, and add one when the layout changes. That visibility is why rung 2 suits a non-coder.
How to choose, in the order you would do it
- Measure the toil. Hours per week now, number of people doing it, and how often the input format changes. If the step takes 10 minutes a week and the format changes monthly, automation barely pays.
- Ask whether the step can be eliminated (rung 1). Eliminating a step has no maintenance cost at all.
- Check stability. A stable file shape suits recorded steps. A file whose columns move around needs a human check whatever you build.
- Check who maintains it. Choose the tool at the edge of the analyst's skills, not beyond it. A script nobody else can read becomes a new key-person risk (the work depends on one person, so if they leave or go on holiday nobody can fix it), which is a different kind of toil.
- Check the failure mode. A good option fails loudly (an error that names the missing column) and keeps the raw file. A bad option keeps running and silently produces a wrong dashboard.
- Check data sensitivity and sharing. Customer or financial data pushed through a personal workflow tool may break company rules; that pushes you toward rung 6.
Worked example (all inputs are assumptions)
Assume the weekly cleanup takes 45 minutes and runs 52 times a year. After automation the analyst still spends 5 minutes a week refreshing and checking, so the saving is 40 minutes, which is 40 / 60 = 0.667 hours per week.
Rung 2 (recorded query steps): build 4 hours, upkeep 2 hours per year, which is 2 / 52 = 0.038 hours per week.
Net saving per week = 0.667 - 0.038 = 0.628 hours.
Break-even = build cost / net weekly saving = 4 / 0.628 = 6.37, so the 7th week.
Rung 5 (Python script, including learning time): build 10 hours, upkeep 4 hours per year, which is 4 / 52 = 0.077 hours per week.
Net saving per week = 0.667 - 0.077 = 0.590 hours.
Break-even = 10 / 0.590 = 16.96, so the 17th week.
Both pay back inside a year, so the cost difference is not the deciding factor. The deciding factors are that rung 2 is something the analyst can read and repair, while the script would depend on learning to code first. I would recommend rung 2 now. What would flip it: files too large for the spreadsheet tool, logic that needs loops or joins across many sources, or a second analyst needing the same output on a schedule without opening a spreadsheet.
Safeguards for a non-coder
- Keep the original export untouched in a dated folder; never overwrite it.
- Add a visible check on the dashboard: row count of the input versus the output, and the total of one key column compared with the raw file. If the numbers differ, the refresh is wrong.
- Write the steps down in half a page: where the file comes from, what each step does, who to ask. This turns the automation from one person's habit into a team asset.
- Review the steps once a quarter or whenever the upstream export changes.
Common mistakes
- Picking the most powerful tool because it looks professional, then being unable to repair it.
- Counting only build time and ignoring upkeep, which overstates the payoff.
- Automating a step that should have been removed at the source.
- No check on the output, so the first sign of a break is a wrong number in a meeting.
Tell me about a time you automated a repetitive task. What was the situation, what did you build or choose and why, how did you measure the before and after, and what maintenance burden or trade-offs did you take on?
Sample Answer
What the interviewer is listening for
A good answer to this question is a short, honest story with five parts: the situation (what was manual, for whom, how often), the choice (what you built or picked and what you rejected), the measurement (a number before and a number after, taken the same way), the validation (how you knew it was right and safe), and the cost (maintenance and trade-offs you accepted). Toil here means repetitive manual work that follows a rule and gives nothing lasting back. If you have no real example, say so and walk through a realistic one as a design you would run; do not present a hypothetical as something that happened.
The story below is a model with invented figures. Replace the details and numbers with your own, but keep the structure.
Situation and the initial manual steps
"Our data team loaded three vendor feeds each week into a staging table (a holding table where new data lands and is checked before it is copied into the table the dashboard reads) behind a revenue dashboard. One load took about 70 minutes by hand:"
| Step | Manual action | Minutes |
|---|---|---|
| 1 | Download the file from the vendor portal | 10 |
| 2 | Rename it and fix the header row | 15 |
| 3 | Load it into the staging table | 10 |
| 4 | Run three sanity queries by hand (quick checks that the data looks plausible: row count, null keys, totals) | 25 |
| 5 | Refresh the dashboard | 5 |
| 6 | Post a status message to the channel | 5 |
| Total per feed | 70 |
Three feeds a week is 3 x 70 = 210 minutes = 3.5 hours per week. In 26 weeks, five loads had gone wrong (usually the wrong file picked up), which is 5 / 26 = 0.19 bad loads per week.
The target
The team's inventory of recurring manual work was 18 hours per week. That figure came from a two-week tally of every repeated manual task, scaled to a week (an invented number in this model; the feed loads were 3.5 of those hours and the schema reviews described near the end were 2.8). We set a goal of cutting at least 30% of it, so 0.30 x 18 = 5.4 hours per week, measured net of the time spent maintaining the automations. One automation could not reach that alone, so the target covered a set of them: the feed script and, further down, a check in the build pipeline.
What I chose and why
I considered three options. A spreadsheet macro was quick but ran on one person's laptop and had no audit trail. A vendor connector would have removed the download step but did not do our checks and added a licence. A script on our existing scheduler (the program that starts jobs at set times), with the sanity queries written as code, reused tooling the team already monitored and could be reviewed in a pull request (a proposed change shown to teammates for review before it is merged). I chose the script. Building it took 22 hours including tests and the runbook (the written steps for operating it).
Validation: how I knew it was right
- For four weeks it ran in parallel with the manual process in a staging table, and I compared row counts and totals with the human-loaded result every week. They matched.
- The script now rejects a file that fails the checks before anything is loaded, posting the reason instead.
- Loads go to a staging table and swap in with one transaction (a database operation that is all or nothing: either the new data replaces the old completely, or nothing changes), and the previous version is kept for 7 days, so rolling back is a swap rather than a repair. I tested the rollback once on purpose.
Before and after, measured the same way
Each run now leaves 10 minutes of review of the posted summary, so time per feed falls from 70 to 10 minutes, saving 60 minutes per feed, 3 x 60 = 180 minutes = 3 hours per week. The scheduler's run log gave the run counts and I used the same stopwatch estimate for the review.
Reliability is a separate measure from time. Before: 5 bad loads in 26 weeks (0.19 per week). After: none in the first 13 weeks. Be careful with that claim: if the old rate had continued, we would have expected 13 x 0.19 = 2.5 bad loads, and the chance of seeing zero by luck, assuming bad loads arrive independently at a steady rate, is e to the power of minus 2.5, about 8%. Where that comes from: if events arrive at an average of 2.5 per 13 weeks, the chance of a 13-week stretch with none is e−2.5=1/2.7182.5=1/12.2≈0.082, where 2.718 is the constant e. About 1 quiet stretch in 12 would happen by luck alone. It is encouraging, not proof, so I also report the evidence that does not depend on luck: the checks rejected two bad vendor files in those 13 weeks before anything reached the dashboard.
Maintenance and trade-offs
- Upkeep: the vendor changed its file layout twice in 26 weeks and each fix took about 3 hours, so 2 x 3 / 26 = 0.23 hours per week. Net saving is 3 - 0.23 = 2.77 hours per week, and payback on 22 hours is 22 / 2.77 = 7.9 weeks.
- A single person understood the script at first; I paired with a teammate on a change so the knowledge was shared, and the runbook now covers the common failures.
- Alerts needed tuning, because a vendor delay should wait rather than page someone at night.
- The team's hands-on knowledge of the feed shrinks when nobody loads it by hand; the checks and a quarterly walkthrough are how we keep that knowledge.
Stakeholder reaction
The analyst who ran the loads worried about losing control of the data and, indirectly, her role. We addressed it by running side by side before switching, giving her ownership of the check rules, and moving her time to the exception reviews. The finance consumers wanted to see the checks, so the summary message lists them.
A second piece that reached the target: a developer workflow in CI
Reviewers spent about 2.8 hours a week eyeballing schema changes before merging. We turned the rule they applied into a check in continuous integration (CI, the automated build and test run on each change), so a pull request that breaks the rule fails with a message, and humans review only the changes that pass. Building the check took 6 hours (assumed) and upkeep was about 0.1 hours per week, so the net saving is 2.8 - 0.1 = 2.7 hours per week and the payback is 6 / 2.7 = 2.2 weeks. Net across both: 2.77 + 2.8 - 0.1 = 5.47 hours per week, and 5.47 / 18 = 30.4% of the 18-hour baseline, just above the 30% goal.
Reliability validated afterwards
Beyond time saved, I reported error rate (bad loads per week), pages and incidents tied to the task, the number of checks that rejected input, and rollback readiness (the swap was tested, the previous version available). Those would be the ones to keep tracking.
Common mistakes
- Telling the story with a "before" number and no "after", or measuring them differently.
- Claiming reliability improved from a short quiet period.
- Leaving out what the automation costs to keep, or who now owns it.
- Describing a team effort in "we" for the whole answer so your own part is invisible.
A weekly manual report takes one analyst 3 hours to prepare and is run 52 times a year. The analyst's loaded hourly cost is $50. An automation is estimated to take 20 hours to implement and $100/month to maintain. Calculate first-year savings, recurring annual savings, and payback period. Show your calculations and state assumptions. Include a sensitivity check if maintenance doubles to $200/month.
Sample Answer
The idea in plain words
Automating a task is an investment: you pay once to build it (the build cost), you pay a little every month to keep it working (maintenance), and in return you stop paying people to do it by hand (the saving). The payback period is how long the saving takes to cover the build cost. The loaded hourly cost is what an hour of the analyst costs the company in total (salary plus benefits and overhead), here USD 50. The common mistake is to compare the saving with the build cost alone; maintenance is a running cost and belongs in every line.
Assumptions
- The automation removes all 3 hours of the weekly report (no human review step left). Any residual review time would shrink the saving, and a real estimate should ask for it.
- The 20 build hours are valued at the same USD 50 per hour as the analyst's time, and are spent before the first automated run.
- Maintenance is USD 100 per month, paid for the full 12 months, and the report still runs 52 times a year.
- Savings start in week 1 after the build (no ramp-up, no discounting of future money).
Method
gross saving per year=h×n×c recurring net per year=gross saving−12m first-year net=recurring net−H×c payback=recurring net/52H×c weeksHere h is hours saved per run (3), n is runs per year (52), c is the loaded hourly cost (USD 50), m is monthly maintenance, and H is build hours (20). Recurring net is what the automation earns in every year after the first; first-year net also pays the build cost.
Worked calculation (by hand)
- Gross saving per year: 3 h x 52 x USD 50 = 156 h x USD 50 = USD 7,800.
- Build cost: 20 h x USD 50 = USD 1,000.
- Maintenance per year: USD 100 x 12 = USD 1,200.
- Recurring annual savings: 7,800 - 1,200 = USD 6,600.
- First-year savings (net of build): 6,600 - 1,000 = USD 5,600.
- Payback: weekly net saving is 6,600 / 52 = USD 126.92, so 1,000 / 126.92 = 7.88 weeks, about 1.8 months (7.88 x 12 / 52 = 1.82).
Sensitivity: maintenance doubles to USD 200 per month
Maintenance becomes USD 2,400 per year, so recurring savings are 7,800 - 2,400 = USD 5,400, first-year net is 5,400 - 1,000 = USD 4,400, and payback is 1,000 / (5,400 / 52) = 9.63 weeks, about 2.2 months. Doubling maintenance cuts recurring savings by 1,200 / 6,600 = 18%, but the decision does not change: it still pays back in well under a quarter. The saving per month is 7,800 / 12 = USD 650, so maintenance would have to exceed USD 650 per month (6.5 times the estimate) before the automation stopped earning anything.
The same method at team scale
Assumptions: 30 hours per week of manual work, the automation removes 80% of it (24 hours per week), 200 build hours, and upkeep of 15% of build hours per year (0.15 x 200 = 30 hours, 0.58 hours per week). Weekly saving is 24 h x USD 50 = USD 1,200. Gross saving per year is 24 x 52 x 50 = USD 62,400, maintenance is 30 x 50 = USD 1,500, and the build is 200 x 50 = USD 10,000. Recurring net is 62,400 - 1,500 = USD 60,900, first-year net is 60,900 - 10,000 = USD 50,900 (1,018 hours), and break-even is 10,000 / (60,900 / 52) = 8.54 weeks, about 2 months.
The program
The program below computes every line above and checks it a second way: it walks week by week, adding the weekly saving minus the weekly share of maintenance to a running balance that starts at minus the build cost, and confirms the first week the balance is non-negative equals the formula's payback rounded up to a whole week. A version of the formula that ignored maintenance fails this check.
import math
WEEKS = 52 # weeks per year, so a weekly task runs 52 times
def payback(hours_per_week, rate, build_hours, maint_per_year, share_removed=1.0):
"""Annual saving, first-year and recurring net, payback in weeks and months."""
gross = hours_per_week * share_removed * WEEKS * rate # USD per year
build = build_hours * rate # USD, one-off
recurring = gross - maint_per_year # USD per year
first_year = recurring - build # USD
weekly_net = recurring / WEEKS # USD per week
weeks = build / weekly_net if weekly_net > 0 else math.inf
months = weeks * 12 / WEEKS
return gross, build, recurring, first_year, weeks, months
def weekly_walk(hours_per_week, rate, build_hours, maint_per_year, share_removed=1.0):
"""Independent check: walk week by week until cumulative net turns non-negative."""
cum = -build_hours * rate
for w in range(1, 10 * WEEKS):
cum += hours_per_week * share_removed * rate - maint_per_year / WEEKS
if cum >= 0:
return w, cum
return None, cum
def show(label, hours_per_week, rate, build_hours, maint_per_year, share=1.0):
g, b, r, f, wk, mo = payback(hours_per_week, rate, build_hours, maint_per_year, share)
print(f"{label}")
print(f" gross saving per year = {hours_per_week * share:g} h x {WEEKS} x {rate} = {g:,.0f} USD")
print(f" build cost (one-off) = {build_hours:g} h x {rate} = {b:,.0f} USD")
print(f" maintenance per year = {maint_per_year:,.0f} USD")
print(f" recurring net per year = {g:,.0f} - {maint_per_year:,.0f} = {r:,.0f} USD")
print(f" first-year net = {r:,.0f} - {b:,.0f} = {f:,.0f} USD")
print(f" payback = {b:,.0f} / ({r:,.0f} / {WEEKS}) = {wk:.2f} weeks = {mo:.2f} months")
walk_week, cum = weekly_walk(hours_per_week, rate, build_hours, maint_per_year, share)
ok = walk_week == math.ceil(wk)
print(f" check: weekly walk first non-negative in week {walk_week}, ceil(formula) = {math.ceil(wk)} -> {'PASS' if ok else 'FAIL'}")
assert ok
return f
print("== Small task: 3 h per week, 50 USD/h, 20 h build ==")
show("maintenance 100 USD/month", 3, 50, 20, 100 * 12)
show("maintenance 200 USD/month", 3, 50, 20, 200 * 12)
print(" without maintenance (wrong, overstated): payback =",
f"{20 * 50 / (3 * 50):.2f} weeks")
print()
print("== Team scale: 30 h per week manual, 80% removed, 200 h build, 15% of build hours per year upkeep, 50 USD/h ==")
build_h = 200
upkeep_h = 0.15 * build_h
print(f" upkeep = 0.15 x {build_h} = {upkeep_h:g} h per year = {upkeep_h * 50:,.0f} USD per year")
f = show("team", 30, 50, build_h, upkeep_h * 50, share=0.8)
print(f" hours view: saved {30 * 0.8 * WEEKS:g} h/yr, less {build_h} h build, less {upkeep_h:g} h upkeep = {30 * 0.8 * WEEKS - build_h - upkeep_h:g} h net in year one")
Output:
== Small task: 3 h per week, 50 USD/h, 20 h build ==
maintenance 100 USD/month
gross saving per year = 3 h x 52 x 50 = 7,800 USD
build cost (one-off) = 20 h x 50 = 1,000 USD
maintenance per year = 1,200 USD
recurring net per year = 7,800 - 1,200 = 6,600 USD
first-year net = 6,600 - 1,000 = 5,600 USD
payback = 1,000 / (6,600 / 52) = 7.88 weeks = 1.82 months
check: weekly walk first non-negative in week 8, ceil(formula) = 8 -> PASS
maintenance 200 USD/month
gross saving per year = 3 h x 52 x 50 = 7,800 USD
build cost (one-off) = 20 h x 50 = 1,000 USD
maintenance per year = 2,400 USD
recurring net per year = 7,800 - 2,400 = 5,400 USD
first-year net = 5,400 - 1,000 = 4,400 USD
payback = 1,000 / (5,400 / 52) = 9.63 weeks = 2.22 months
check: weekly walk first non-negative in week 10, ceil(formula) = 10 -> PASS
without maintenance (wrong, overstated): payback = 6.67 weeks
== Team scale: 30 h per week manual, 80% removed, 200 h build, 15% of build hours per year upkeep, 50 USD/h ==
upkeep = 0.15 x 200 = 30 h per year = 1,500 USD per year
team
gross saving per year = 24 h x 52 x 50 = 62,400 USD
build cost (one-off) = 200 h x 50 = 10,000 USD
maintenance per year = 1,500 USD
recurring net per year = 62,400 - 1,500 = 60,900 USD
first-year net = 60,900 - 10,000 = 50,900 USD
payback = 10,000 / (60,900 / 52) = 8.54 weeks = 1.97 months
check: weekly walk first non-negative in week 9, ceil(formula) = 9 -> PASS
hours view: saved 1248 h/yr, less 200 h build, less 30 h upkeep = 1018 h net in year one
Judgment
Do it: first-year net is positive in both cases, payback is under a quarter, and the result survives doubled maintenance. What would flip it: a residual human review that eats half the 3 hours, a report that is cancelled or changes shape within months (the build is wasted), or a maintenance burden measured in days rather than dollars. State the figures as estimates and re-measure after a quarter of real runs.
Common mistakes
- Dropping maintenance (payback looks like 6.7 weeks instead of 7.9).
- Mixing weekly and monthly units: divide by 52 for weeks or by 12 for months, never one for the numerator and the other for the denominator.
- Calling the saving "first-year savings" without subtracting the build cost, or reporting first-year net as the recurring figure.
- Assuming 100% of the time is saved without asking what review remains.
Running the code
Save the program as report_payback.py and run python report_payback.py (Python 3.12, standard library only, no install, no input files).
An order-to-cash process spans several systems and teams, and nobody has a clear picture of where the manual effort sits. How would you use event-log data and process-discovery analysis to find the best automation opportunities, and what would tell you a candidate is not worth automating?
Sample Answer
The idea in plain words
Process mining reads the timestamps that the systems already record and rebuilds what actually happens to each order, instead of what people say happens. An event log is a table with one row per thing that happened: a case identifier (here, the order number), an activity name ("credit check", "invoice sent"), a timestamp, and who or what did it (a person or a system user). Process discovery is the analysis that turns that table into a map of the paths orders really take, including the loops and detours. The map shows where effort sits; it does not by itself say what is worth automating. That needs a second filter: volume x touch time, then whether the step should exist at all.
Step 1: Build the event log
- Define the case. One order, from order receipt to cash applied (order-to-cash means everything between a customer ordering and the money being matched to the invoice).
- Extract events from each system (order entry, credit, shipping, billing, payments) and join them on the order number. Record for each event: case id, activity, timestamp, resource (a named person or a system account), and system.
- Check data quality first. Missing order numbers across systems, timestamps in different time zones, batch jobs that stamp hundreds of events at the same second, and work done by email or phone that never reaches a log. A log shows the work that systems see, so offline work must be added by sampling or interviews.
Step 2: Discover and measure
| Analysis | What it shows | What to look for |
|---|---|---|
| Directly-follows map and variants (distinct paths) | The real paths | A few variants usually carry most orders; long tails of rare variants are exceptions |
| Manual vs system activities (by resource type) | Where people touch the case | Activities done by named people on most cases |
| Rework loops (the same activity repeated, or a step that sends the case back) | Defects, not work | Mismatch fixes, re-entered data |
| Waiting time (gap between one activity ending and the next starting) | Queues | A long wait with little touch time is a queue, not a task |
| Touch time (time a person works on the case) | Effort | Use start and end events where they exist; otherwise sample with a short time study, since gaps between timestamps include waiting |
Terms in the table, in plain words. A directly-follows map is a diagram with one box per activity and an arrow from A to B, labelled with a count, each time B happened immediately after A in some case. A variant is one distinct sequence of activities from start to end of a case, so two orders that took the same steps in the same order share a variant. A resource is who or what performed the activity (a person's login or a system account). Touch time is the time someone actually works on the case; waiting time is the gap with nobody working on it.
Reading a few event-log rows
Here are 8 rows from two orders, with the start and end of each activity (illustrative data, not from a real company). The program splits each row into touch time (end minus start) and the wait that follows (next start minus this end), and prints each case's variant:
import pandas as pd
rows = [
(1001, "Re-key purchase order", "clerk_a", "2026-03-02 09:00", "2026-03-02 09:04"),
(1001, "Review credit hold", "clerk_a", "2026-03-02 09:04", "2026-03-02 09:16"),
(1001, "Approve credit hold", "mgr_b", "2026-03-03 16:16", "2026-03-03 16:20"),
(1001, "Send invoice", "erp_system", "2026-03-03 16:21", "2026-03-03 16:21"),
(1002, "Re-key purchase order", "clerk_c", "2026-03-02 10:00", "2026-03-02 10:04"),
(1002, "Send invoice", "erp_system", "2026-03-02 10:05", "2026-03-02 10:05"),
(1002, "Fix invoice mismatch", "clerk_c", "2026-03-04 11:00", "2026-03-04 11:25"),
(1002, "Send invoice", "erp_system", "2026-03-04 11:26", "2026-03-04 11:26"),
]
log = pd.DataFrame(rows, columns=["case_id", "activity", "resource", "start", "end"])
log["start"] = pd.to_datetime(log["start"])
log["end"] = pd.to_datetime(log["end"])
log["touch_min"] = (log["end"] - log["start"]).dt.total_seconds() / 60
log["next_start"] = log.groupby("case_id")["start"].shift(-1)
log["wait_h"] = ((log["next_start"] - log["end"]).dt.total_seconds() / 3600).round(1)
print(log[["case_id", "activity", "touch_min", "wait_h"]].to_string(index=False))
print()
for case, g in log.groupby("case_id"):
print(case, " > ".join(g["activity"]))
# Sketch of a build-or-skip check for the two chosen candidates (assumed inputs).
def payback_months(build_h, saved_h_month, upkeep_h_year):
return build_h / (saved_h_month - upkeep_h_year / 12)
intake_saved = 0.90 * 6500 * 4 / 60
cash_saved = 0.70 * 1500 * 10 / 60
print()
print(f"intake: saves {intake_saved:.1f} h/month, payback {payback_months(600, intake_saved, 60):.1f} months")
print(f"cash application: saves {cash_saved:.1f} h/month, payback {payback_months(500, cash_saved, 80):.1f} months")
Output:
case_id activity touch_min wait_h
1001 Re-key purchase order 4.0 0.0
1001 Review credit hold 12.0 31.0
1001 Approve credit hold 4.0 0.0
1001 Send invoice 0.0 NaN
1002 Re-key purchase order 4.0 0.0
1002 Send invoice 0.0 48.9
1002 Fix invoice mismatch 25.0 0.0
1002 Send invoice 0.0 NaN
1001 Re-key purchase order > Review credit hold > Approve credit hold > Send invoice
1002 Re-key purchase order > Send invoice > Fix invoice mismatch > Send invoice
intake: saves 390.0 h/month, payback 1.6 months
cash application: saves 175.0 h/month, payback 3.0 months
How to read it. wait_h is the gap after that row ends until the next row in the same case starts, so a 0.0 means under about three minutes and NaN marks the last row of a case. Order 1001 spent 12 minutes in the credit review at 09:04 to 09:16 on 2 March, then the approval began at 16:16 on 3 March: that gap is 31 hours (24 hours from 09:16 on 2 March to 09:16 on 3 March, plus 7 hours to 16:16), while the total touch time of the case is 4 + 12 + 4 = 20 minutes. This is how a timestamp gap is split into work and wait. Order 1002 shows a different variant: it was invoiced, then a mismatch was found, fixed (25 minutes of touch) and the invoice was sent a second time. The repeated Send invoice is a rework loop, visible only because the log keeps every event. The last two printed lines apply the payback arithmetic of the next section to the two chosen candidates.
Step 3: Rank the opportunities (worked example, assumed numbers)
Assume 10,000 orders a month and the following manual activities found in the log (counts of cases touched and the mean touch minutes are assumptions for illustration):
| Activity | Cases per month | Mean touch (min) | Manual hours per month |
|---|---|---|---|
| Re-key customer purchase order into the order system | 6,500 | 4 | 6,500 x 4 / 60 = 433.3 |
| Fix invoice mismatch | 900 | 25 | 900 x 25 / 60 = 375.0 |
| Chase late payment | 2,400 | 8 | 2,400 x 8 / 60 = 320.0 |
| Apply cash to invoices manually | 1,500 | 10 | 1,500 x 10 / 60 = 250.0 |
| Review credit hold | 1,200 | 12 | 1,200 x 12 / 60 = 240.0 |
| Total | 1,618.3 |
Manual hours per month = cases x mean touch minutes / 60.
Reading it: re-keying the purchase order is the biggest block (433.3 of 1,618.3 hours, 26.8%) and is pure data movement, so the first candidate is an electronic order intake (an interface from the customer's system or a structured file) instead of typing. Applying cash is the second candidate: matching a bank payment to an invoice follows rules (same reference, same amount), it happens 1,500 times a month, and each case is the same short task, so a program can take the clear matches and leave the rest to a person.
Every row gets a verdict from the checks in the next section, not only the top two:
| Activity | Hours per month | Verdict |
|---|---|---|
| Re-key purchase order | 433.3 | Automate: pure data movement, remove the typing at the source |
| Fix invoice mismatch | 375.0 | Fix the cause first: it is rework from upstream defects such as wrong prices |
| Chase late payment | 320.0 | Partly: automatic reminders for routine cases, a person for disputes; the reminders do not remove the lateness |
| Apply cash to invoices manually | 250.0 | Automate: rules-based, high volume |
| Review credit hold | 240.0 | Queue problem: the elapsed time is wait, not touch |
What tells you a candidate is not worth automating
- It is waiting, not work. Suppose the credit hold review takes 12 minutes of touch but the median case waits 31 hours for an approver (the gap order 1001 shows above, taken here as the median; in a real log you would compute the median across all cases). Automating the 12 minutes barely changes the elapsed time; fixing the approval queue (routing, cover, a time limit) does. Check waiting time against touch time before you build.
- It is rework caused upstream. The 375 hours spent fixing invoice mismatches come from somewhere, for example wrong prices in the price list. Automating the fix keeps the defect alive; fixing the price data removes the work. The test: does the loop disappear if the cause is fixed? If yes, fix the cause.
- It should not exist. A manual approval that never rejects anything (compare approvals with rejections in the log) is a control that costs hours and checks nothing; ask whether it can be removed or reduced to a threshold.
- High variability and judgement. If a step has dozens of variants each affecting a handful of cases, an automation covers little and needs constant rule changes.
- Low volume x low touch time. Under an hour a month does not repay a build, whatever the technology.
- The process is about to change (a system replacement or a policy change within the payback period).
- The log cannot see it. If most of the effort happens in email or calls, the discovery output undercounts it; measure before deciding.
Putting it together
For each candidate compute manual hours per month (above), the share that is routine (rules-based), and the cost to build and maintain; then apply the checks in the list. In this example I would automate the order intake and the cash application, fix the price data before touching the mismatch handling, and take the credit hold to the process owner as a queue problem. The build-or-skip test for the two chosen candidates uses payback in months = build hours / (hours saved per month - upkeep hours per month). Assumed inputs: intake saves 90% of 433.3 hours = 390.0 hours a month, costs 600 hours to build and 60 hours a year to keep running, so payback = 600 / (390.0 - 5) = 1.6 months. Cash application saves 70% of 250 hours = 175.0 hours a month, costs 500 hours to build and 80 hours a year to keep running, so payback = 500 / (175.0 - 6.7) = 3.0 months. Both clear a three-year horizon easily; the same test on a task saving 5 hours a month with a 100-hour build and 24 hours a year of upkeep gives 100 / (5 - 2) = 33 months, a skip. I would validate the discovery with the people doing the work, because the log shows what happened but not why.
Common mistakes
- Treating the process map as the answer instead of ranking activities by hours.
- Counting elapsed time between events as effort.
- Automating the symptom (mismatch fixing) of an upstream defect.
- Ignoring work that never appears in any system log.
Running the code
Python 3.12 with pandas 2.2. Save the program as event_log.py and run python event_log.py.
Unlock Full Question Bank
Get access to all 10 Automation and Toil Reduction interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.