Demand Planning and Analytics in Excel: Fast Formulas Over 65K+ Rows

Original Source:  Production Scheduling 

“Analytics for demand planning in Excel usually involves big tables of data.  To understand the demand for a product, you need to look into its history.  Analytics with an order history over a year or more can have 100K+  records.  Here is a technique to perform fast analytical formulas on many thousand rows.

The order history will come out of a transaction system, usually MRP / ERP.  Each order record is a single order for a product, so it is a raw, lumpy transaction history.  It is helpful to smooth this demand out, so a common analytics calculation is the rolling average.  A rolling average over n days is much better than a weekly or monthly average and allows demand planners to calculate a service level for every part.

The easiest way to calculate this using the Excel AVERAGE formula across a fixed range of cells that represents the rolling average period.  The problem with this method is that it requires your order history to have zero values for non-order days.  After all, in our analysis we want to know what the average demand is for all days (calendar or working) not just the days that happen to have orders for that product.

Furthermore, the order date is not necessarily the most relevant date.  A much better date is usually the due-date or commit-date when the order should ship out.  So, combining the order book with all those extra date records is not practical.

In analytics for demand planning, we want to calculate rolling averages and service levels for every product, on every order day.  This requires single formula that we can apply to the order history and see how smoothed demand changes over time.

It looks like this formula will involve SUMIF and COUNTIF.  More precisely, multiple condition SUMIFs and COUNTIFs for the product code and date ranges.  Excel 2007 has SUMIFS, COUNTIFS formula and those on Excel 2003 can use SUMPRODUCT or  SUM(IF…) array formulas.

The trouble is that SUMIF is a very calculation intensive formula.  Just try and paste a SUMIF formula to every row in a table with 10K+ rows and see how long it takes.  We can avoid doing SUMIF (and COUNTIF etc) on a long criteria range by sorting first.

Excel sorts very fast.  You can sort a table of demand data by product code and date in an instant.  You have the choice to use a pivot table or Data|Sort command in the menu ribbon or bar.  The sorted range can then be identified using the first row and last row numbers.  The first and last row for a continuous list of product codes is a replacement for putting the product code as a criteria.   This makes your criteria ranges much smaller and the formula calculation much faster…”

You must be a SIG member and logged in to view this document.