How to predict cricket scores [Excel + Machine Learning]

Share

Facebook
Twitter
LinkedIn

Can we predict cricket match score in Excel? Using machine learning, ensemble modeling, multiple regression and Excel formulas we can. This tutorial explains how.

Cricket world cup is on. Both my homes (India & New Zealand) have done well so far in the tournament and if things go OK in the last couple of matches, they should qualify for semi-finals. The games are happening in UK, which is 12 hours behind New Zealand. You know that means?

Sleepless in wellington - watching cricket matches

Yes, lots of sleepless nights in Wellington.

As I watch these games, I notice that every once in a while they show a “score predictor“. It will tell you what the final score could be based on the proceedings of the game so far.

So I thought, hmm, May be I should make one of those in Excel?

That is what I did. I created a machine learning model in Excel to predict cricket score. Sounds interesting? Read on.

Cricket?!? What now?

If you are thinking “the only cricket that keeps me up all night is the damned chirping one in my basement”, then don’t worry. You need very little knowledge of cricket to understand the techniques. Once you know the ideas you can apply them to many other real life problems like predicting sales next year or student absences next term or electricity usage in the new plant.

Defining the problem – Cricket Score Prediction

Just a quick note if you are not familiar with cricket. In a typical one-day match, two sides compete. The game starts with one of teams batting first and scoring some runs in 50 overs. The next team then tries to beat that target set by first team in 50 overs.

Let’s start by defining the problem. We want to create a cricket score predictor that takes the inputs:

  • Country playing – C
  • Runs scored so far in the match – Rs
  • Wickets remaining in the match – WR
  • Overs remaining – OR

Our predictor should tell us what could be the final score at end of 50 overs.

For example, we could ask, “Australia scored 52 runs in 10 overs losing 1 wicket. What would be the final score?” and our predictor can provide a guess – say 305 runs.

Things we ignore:

The final score of a team in a cricket match depends on many things, including:

  • The playing team and their batsmen
  • The opposition team and their bowlers, fielders
  • The ground and pitch they play on
  • The weather and historical weather
  • Crowd attending the game and how much they are cheering
  • What the umpires had for lunch
  • etc.

If we try to incorporate every little thing that matters, we will never be able to construct our prediction model. So let’s ignore everything except those 4 parameters (C, Rs, Wr, Or) listed above.

Our model as an equation

Let’s say Rp denotes our predicted Runs. We can define Rp as

Rp = p(C, Rs, Wr, Or)

where

  • C = Country
  • Rs = Runs already scored
  • Wr = Wickets Remaining
  • Or = Overs Remaining
  • p is a prediction function that does some magic to calculate Rp

But we know that Rp = Rs + something

This is because total runs at the end of 50 overs will be something more than Runs Scored at the time of prediction.

If we can find something our problem is solved. But how?

Introducing Run Rate

Run rate is ratio between runs scored and overs completed. So if India scores 342 runs in 50 overs, their run rate is 6.84. As our prediction model is for 50 overs, if we know the Run Rate, we will know final score.

Let’s define few more variables.

  • Os (Overs so far) = 50 – Or
  • RRs (Run Rate so far) = Rs / (50-Or)
  • RRr (Run Rate for remaining overs) – this should be predicted

Given these variables, we can rewrite Rp (Runs predicted) as

  • Rp (Runs Predicted) = Rs + Or * RRr

So if we can build a model to predict RRr, we can calculate Predicted score.

We can argue that Run Rate in remaining overs will be a function of (country, run rate so far, overs remaining, wickets remaining)

RRr = f(C, RRs, Wr, Or)

Creating country specific prediction functions

We can further argue that each country has specific strengths and abilities when it comes to batting. So, if we define a set of functions, f1(), f2()…, fn() where fn is

RRr for country n = fn(RRs, Wr, Or)

We can then call the relevant function based on which country we are predicting the score for.

So what is this magical prediction function?

Regression of course. There are many sophisticated machine learning algorithms. But for something straight forward like Run Rate (remaining overs), we can create a simple multiple regression model.

Say RRr can be written as

RRr = m1*RRs + m2*Wr + m3*Or + const

Given a set of training data with RRs, Wr, Or and RRr, we can use LINEST() function in Excel to calculate {m1, m2, m3, const} that fits the sample data. Once we have the multipliers and constant value for each country, we can predict the score for any situation. Its that simple.

Why just one equation per country? Why not more?

As with everything else in life, cricket matches too have significant variability. For that reason, rather than one regression model per country, why not create 10 of them per country and the average the prediction?

As management consultants say,

“When you are not sure what to say, just run a survey and tell them what they said.”

If this sounds like a bunch of bs, don’t worry. This is an actual machine learning technique known as Ensemble Modeling.

Ensemble Modeling

The idea of ensemble modeling is simple. We build multiple models from the training data and then combine the results of all models when making predictions.

See this picture to understand how a typical Ensemble Model works.

Ensemble modeling - illustration

This way, we can create more variation in input scenarios and create a robust model.

For the sake of simplicity, let’s say we want to build 10 regression models for each country.

How to aggregate the ensemble model results?

We will end up with 10 predicted Run Rates (Remaining overs). We can simply average these 10 to come up with final prediction. You can also assign weights to the models and do a weighted average. Let’s stick with simple average.

Let’s get building then.

Machine Learning 101

Learn first, Predict next.

That’s it. But if you want more text, here we go. Almost all machine learning models follow this pattern. They look at some data to construct the model. Once that model is ready, we then test it on a different data set to see how satisfactorily it performs. If the results are not up to scratch, we back to step one and fine tune the model.

The easiest of all these is a regression model. That is the same one we will be using too.

Where is the data?

There are many fine websites for finding current score or recent match results. But in order to train our model, we need a collection of historical match data by each over. This is notoriously hard to get. Thankfully, there is cricksheet. They have historical one day match data at ball by ball level for 1,400 + matches in CSV format. (here is the downloads page)

Note about data: I noticed that cricsheet doesn’t have all matches data. For example I could not find any 2018 games in the data set I downloaded few days ago. It doesn’t really matter as we are using a large sample of data spanning several years.

As you can see, this data is at a too detailed level than what we need.

So I used Power Query to combine 1,400 files, reshape the data to over by over scores and then calculate total score, overs and wickets at every 5 over interval until end of the game. I then took only the recent 300 games as very old performances have little impact on current scoring patterns.

Sorry for not explaining the Power Query or Excel formula steps. That would get too technical and this post will never end.

Once reshaped, my data looks like this:

training data for cricket score prediction model

We can then derive additional columns,

  1. Last over of the game: =MAXIFS([Over], [Source.Name],[@[Source.Name]], [Country], [@Country])
  2. RRs – Run Rate so far: =[@[Cum Runs]]/[@Over]
  3. Or – Overs Remaining: =[@[Max Over?]]-[@Over]
  4. Wr – Wickets Remaining: =10-[@[Cum Wickets]]
  5. Score at end: =SUMIFS formula
  6. RRr – Run Rate (remaining overs)
    =([@[Score at end]]-[@[Cum Runs]]) / [@[Overs Remaining]]

Using 2,3,4 & 6 we can create our regression models.

But before we go there, let’s split the data in to training & test data sets. For this example, I choose the latest 50 games as test data set and everything older as training data. Instead of creating two separate tables, I just added a column at the end to look at [Match ID] to tell me whether something is test or training.

Also, we do not need to use last over data for training. At the end of game there is nothing left to predict, so there is no point of using last over data when training the model.

I have added a data point ID as column to this table so I can uniquely identify all data points when sampling training data. It is [Data point number]

Bagging & Bootstrapping

Don’t freak out. We are still on topic. Bagging is the technical term for the concept of randomly sampling data, building models and then aggregating (ie bagging) at the end.

Bootstrapping refers to random sampling of data.

Our bootstrap approach is rather simple and naive.

  • For each country, we want 10 bags – 10 data sets
  • For each data set, we want a random sample of 50 data points
  • We then create a multiple regression model to fit
    RRr = m1*RRs + m2*Wr + m3*Or + const
  • We average all 10 model results when predicting outcomes.

A note on const: When I was building my cricket score prediction models, I realized that setting const=0 gave me a better R2 (ie the model fits well with training data). So I set the 3rd parameter of LINEST() to FALSE (ie no need for const). You may want to keep it on for other types of models.

In my training data from cricsheet, we have 16 countries. That means we need 16*10*50 = 8,000 data points to construct the models.

Using a bunch of RANDBETWEEN, INDEX+MATCH and COUNTIFS, I was able to construct this grid.

ensemble model - input data

Constructing Multiple Regression Models

Once data grid is ready, we can create a bunch of LINEST() formulas to tell us the multipliers (m1, m2, m3) for each model. This can be done 160 times (each of the 16 countries need 10 models). But I am very lazy. So I used INDEX() formula to fetch arrays of 50 cells so that LINEST results can be tabulated nicely. This is how our multiple regression model looks:

sample results from multiple regression - cricket score prediction
sample-results-ensemble-model-for-cricket-score-prediction

As you can see, our model has very high R2 values. This is promising.

Mind the F

While high R2 values are good, you should not trust the model blindly. You should also check if the relationship between output (Run Rate in remaining overs) and inputs (RRs, Or, Wr) is chance. This can be done by looking at F statistic and F distribution probability. I have not bothered with this step for all of the data, but I did check for few samples to see if the F probability is low (low means relationship is not random).

Learn more about F statistic and how to interpret the results.

Calculating final prediction

As you can see, each model predicts Run Rate (in remaining overs). But we need to predict the score. Given the inputs:

  • C = Country
  • Rs = Runs already scored
  • Wr = Wickets lost so far
  • Or = Overs Remaining

We can calculate predicted Runs (Rp) as

  • RRr = average of all 10 country specific predictions (RRs, Wr, Or)
  • Rp = Rs + RRr * Or

In simple words, our final prediction is Runs already scored + average of 10 predicted run rates times remaining overs.

Testing our ensemble model against some of the recent matches

Now that we have our shiny ensemble models, let’s go test them. I have extracted score data from last 50 games by innings. I then filtered away any games with less than 50 overs played (canceled due to rain, chased before the last ball etc.)

This is what we have.

test data for testing cricket score predictor
test-data-for-cricket-score-prediction-testing

For prediction, we also need to know what were the runs scored and how many wickets they had in hand at certain over. I started by creating a scrollbar to select the over (any multiple of 5 between 5 and 40). Then we fetch the relevant inputs from test data and run the model against them to calculate predicted score. I then compared this against actual score to see what kind of error and accuracy our model is getting.

ensemble model - test results explained
test-results-how-to-read-them-and-notes

This involved using some crazy, but fun MMULT and INDEX functions (ofcourse, TRANSPOSE too). It is 2:19 AM as I am typing this. That means, Unfortunately, it is too late in the game to explain the formula logic here, so I will leave it to your imagination.

Here is how our model compares with actual results at 15 overs.

Actual vs. Predicted scores - cricket match score prediction model
actual-vs-predicted-score-15-overs

And this is how it works after 25, 35 and 40 overs. As you can see, accuracy improves the later in game you ask for prediction.

Predicting India’s score against Bangladesh – 2nd July, 2019

Right now, as I am typing this, India is playing against Bangladesh. India have score 314 in 50 overs. I wanted to see how our model predicts the score at various points in game. As you can see, it gets a little optimistic (as India didn’t loose a wicket until 30th over) but the prediction gets closer since 35th over.

India vs. Bangladesh worldcup match - 2nd July 2019 - score prediction vs. actual

Download cricket score prediction model & play with it

If you want to examine the calculations, predict your own scores or just want to see how its all done, here is the file.

In the download:

  • You will find two models, not one. This is because I built two regression models to see which will give better prediction. The one presented in this article gives better results.
  • You will find a simple score predictor too. Enter inputs (Country, runs so far, wickets so far and overs) and it will tell you what the predicted score is.
  • All calculations and data.

Feel free to mash up the data to create your own prediction tool.

How I built the score predictor – video

I made a short (oh well, 37 minutes long) video explaining the process, machine learning concepts and Excel implementation. Watch it below or see it on Chandoo.org youtube channel.

References – on Machine learning, Excel and statistics

This is an interesting topic and I am sure you want to know more. See below references to understand the concepts better.

How do you like the score predictor?

I had so much fun creating this. I did have a few false starts and made models with wrong equations, but eventually came up with something that provides sensible prediction. I am happy with the way it turned out. Although I couldn’t explain every little thing about the model in this post, I hope you are able to fill those gaps in.

Do you like this prediction model in Excel? Are you surprised to see a complex machine learning algorithm implemented in good ol’ spreadsheet? Share your thoughts in the comments.

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

34 Responses to “Find Quarterly Totals from Monthly Data [SUMPRODUCT Formula]”

  1. Daniel Ferry says:

    Chandoo,

    Very nice post. In most cases I would use a formula such as yours so that copying is automatic. But for instructional purposes, consider this alternative for the Q1:

    =SUMPRODUCT((MONTH(B$4:B$15)={1,2,3})*C$4:C$15)

    Besides being shorter, this formula is crystal clear in function. Then for the other quarters you would just change the array constants to the months of that quarter. For example, Q2:

    =SUMPRODUCT((MONTH(B$4:B$15)={4,5,6})*C$4:C$15)

    Now I know there are a lot of accountant types out there that think using constants in a formula is some sort of heresy. I think that idea is silly. If the formula is clear and maintainable, constants are ok by me. But if this idea shakes anyones soul, these constants could easily be encapsulated in named formulas and then the formula above could look like this:

    =SUMPRODUCT((MONTH(B$4:B$15)=Quarter1)*C$4:C$15)

    The SUMPRODUCT function is truly magical, as you put it. This article goes into some advanced uses:
    http://www.excelhero.com/blog/2010/01/the-venerable-sumproduct.html

    Regards,
    Daniel Ferry
    excelhero.com

    • David says:

      I have a column of dates(xx/xx/xx) on a sheet that represents when a task is completed. How do I code a formula on a separate sheet(Summary Page) of the total number of completions within a quarter?
      ie;
      Task Date Completed
      task1 02/05/14
      task2 04/01/14
      task3 08/01/14

      I need a formula that scans that column and then adds the number of tasks completed within each quarter of the year.

  2. Martin says:

    Chandoo,

    as usual, great tip.

    Ever since i read this post, I am struggling with a table that has the same layout as the example, and I wanted to add the totals per year and per Q, years as rows, Qs as columns. The first thing I've noticed is that I had to add the double minus to the roundup portion in order to make it work, even my dates ARE dates...but what i cannot figure out is how to summarize by year. I've tried adding a Year(a1:a20)=2010 to the sumproduct, but it returns 0, and I have the Pivot table below to prove that wrong (aaah, how easy was to have that with the pivot table....!!)

    btw, I was playing around with PTs, adding calculated fields and items to solve variations between Actuals and Budgets and Prior Years. Once you get the formulae right, it's sooooo easy to do, and the results are awesome !!!

    all the best,

    Martín

  3. Alan says:

    Amended Chandoo's formula to add a year and it worked fine.

    SUMPRODUCT((YEAR($B$4:$B$15)=2010)*(ROUNDUP(MONTH($B$4:$B$15)/3,0)=ROWS($E$4:F4))*$C$4:$C$15)

  4. Alan says:

    Chandoo

    I generally do quarters in the same way galthough I would have changed the number format of cells E4:E7 to Q0, so that I could reduce to formula length by referring directly to these cells. SUMPRODUCT((ROUNDUP(MONTH($B$4:$B$15)/3,0)=E4)*$C$4:$C$15).
    I like Daniel's suggestion of a named range. Great site.

  5. winston says:

    Thanks Chandoo,

    I use a tbl to create relationshipp for each period to its quartile

    Jan Q1
    Feb Q1
    Mar Q1

    Create a lookup in a helper column to lookup the correct quartile.
    Use Sumif on the column with the quartile

    Best regards,
    Winston

  6. Chandoo says:

    @Daniel: Excellent insights as always. I am finding SUMPRODUCT formula really really powerful.

    I didnt know that we can write conditions like ={1,2,3}. I remember trying that but it didnt work. thanks for telling me how to do it. I like your idea of named ranges. It will keep things simple and also let the reports to easily transformed if one needs to change Q1 from JAN-MAR to APR-JUN.

    @Martin: See Alan's comments. Also, I liked your question, so I am doing a follow up post on it today. Refer to it to find out how you can get quarterly totals from multi-year monthly data.

    @Alan: Very good tips. Thank you. Infact, in the download file you would find the formula to be slightly different. I used ROWS() so that I need not change the values for each quarter. I guess either technique works fine.

    @Winston: Thanks for sharing your technique. Using helper columns is a fine option too. It keeps the formulas clean and simple. I was just curious and investigated to find if there is a formula that would avoid helper columns.

    • Jason says:

      Chandoo, I learn so much from your posts. Thank you for this!

      I was wondering, how would this get applied to a dashboard with a dynamic date slider?

      Right now I show sales for the week, month, and year based on the date I choose. I've yet to discover how to calculate quarterly numbers based on my date selection.

      My date is determined by: =DATE(2018,12,31)+7*(A2-1) with A2 updating based on the slider.

      Sales This Month is calculated as: =SUMPRODUCT((MONTH(Data[Order Date])=MONTH(D2))*(Data[Sales Amount])) with D2 containing the date formula above.

      ANy suggestions?

      • Chandoo says:

        Thanks for your question Jason.

        It seems you have data at date (or even lower level). In such cases, you need either two conditions or probably SUMIFS to solve this. For example with SUMIFS,
        =SUMIFS(data[sales amount], data[order date],">="&quarter_start, data[order date],"<"&quarter_end) where quarter_start = date(year(a2), choose(month(a2), 1,1,1,4,4,4,7,7,7,10,10,10), 1) and quarter_end = date(year(a2), choose(month(a2), 4,4,4,7,7,7,10,10,10,13,13,13), 1) can work.

  7. Kamran says:

    How about if we have the data in weeks and we want to roll it up in Q1, Q2, Q3, Q4
    will this work for Q1:
    =SUMPRODUCT((MONTH(B$4:B$15)={1,2,3,4,5,6,7,8,9,10,11,12,13})*C$4:C$56)

  8. yreadthis says:

    nice article to use the new things on the excel to calculate the needed ports...The use of tables shows the image view than the wordings, since images are easily recorded in the mind of users than the words to be read...

  9. [...] Quarterly data in a formula May 4, 2010 at 9:12 AM | In General | Leave a Comment Tags: month, formulas, flag, quarter, sumproduct Chandoo wrote a post about combining the power of SUMPRODUCT with a small mathematical trick in order to calculate a quarterly sum from a monthly data table. [...]

  10. Kyle says:

    I have an issue, much different yet has some similarities...

    I have two worksheets... 'Summary' worksheet and 'Stop pays' worksheet.
    The summary sheet has the $ amount of checks paid each week. (example. A1= 1/1/10, B1= $100,000.00; A2= 1/8/10, B2= $120,000.00, A3= 1/15/10, etc...for 52 weeks)

    On the stop pays sheet is a list format of each check that was voided at a later date... (example. column A= original check date, column B= check voided amount, column C= void date. A2= 1/1/10, B2= -$100.00; A3 = 1/1/10, B3= -$150.00; A4= 1/1/10, B4= -50.00; etc...)

    On the summary sheet in C1, I need to calculate the total checks actually paid out. I have been trying to use combinations of SUMPRODUCT with VLOOKUPS, but can't get anything to work. The result in C1 should $99,700.00

    Any thoughts, all help is appreciated. Thanks, Kyle

  11. Hui... says:

    @Kyle
    Give this a try in Summary!C1 and copy down
    =SUM($B$1:B1)+SUMPRODUCT(1*('Stop Pays'!A2:A100<=Summary!A1)*('Stop Pays'!$B$2:$B$100))

  12. Chandoo says:

    @Kyle... you can use sumif formula...

    Assuming your summary sheet is in range A1:B10, stop pays sheet is in range A1:B20.

    in summary c1 write = b1 - sumif('stop pays'!$a$1:$a$20,a1,'stop pays'!$b$1:$b$20)

    Read more about sumif formula here: http://chandoo.org/wp/2008/11/12/using-countif-sumif-excel-help/

  13. Kyle says:

    @Hui. Thanks, but for some reason this only worked for the first row (C1), when I copied down the results werent accurate.

    @Chandoo. This seems to work perfectly. Thank you.

    Thanks again.

  14. Hui... says:

    @ Kyle
    Chandoo's formula is giving the amount each month (Cheques - Stop Pays)
    Mine is giving a running total from 1/1/10 to the date in Summary!Column A

  15. Priyank says:

    I have monthly data in one sheet and want to calculate quarterly and annual data is two other sheets. all monthly data is arranged across columns. so A1 is jan 2000, b1 is feb 2000, c1 is march 2000 and so on.

    Please help

  16. Chandoo says:

    @Priyank: Assuming your months are (in date format) in A1:X1 and corresponding values are in A2:X2, you can calculate quarterly totals like this:

    =SUMPRODUCT((ROUNDUP(MONTH(A1:X1)/3,0)=1)*(A2:X2)) for Q1. Modify it to get Q2... etc.
    you can use similar logic with YEAR() to get yearly totals.

  17. Stawa says:

    This formula is not working properly in one of my sheets with horizontal cash flows using columns instead of rows. For example, Q1 only sums M1 and Q2 is summing up M2:M4. It doesn align propoerly. The formula works if I create a simple test using same format in excel but not in the model. Can I send the excel to someone?

    Thanks,
    Marc

  18. Ramki says:

    Item 01-Mar 02-Mar 03-Mar 04-Mar Tot.
    Soap 24 12 15 13 (E5-F5)+(G5-F5)+(G5-H5)
    Ketchup 12 10 8 14
    Tea 10 8 5 8
    Soup 12 7 9 11
    Coffee 22 26 14 13
    Hi!!,
    I need your help in fixing above problem.
    I do get day day wise closing stock of my company.To get day sales have to
    substract today's no from prev.day's no. But sometimes today's no is big due to receipt of stock.That time I need to substract prev.day's no from today'no. Pls see formula in tot column.Like this I have to do for 31 days and 250 items.I want one formula in one cell give final result(tot)by satisfying above conditions else I have to punch a formula in above column which is boring ang time consuming.Thanks in advance.

  19. Jon says:

    Hi Chandoo et al,

    My question builds on the post regarding quarterly totals from monthly data. I'm having trouble getting the formula to work when the time period I want quarterly totals for exceeds 12 months. In my case, I have 240 months and need these to be collapsed into 60 quarters. Any suggestions? Or should I simply cut and paste the formula for each 12 month period?

    thanks

  20. DavidH says:

    Hi Chandoo,

    I have a similar problem, but with a twist. I often compare actual and budget data where the actuals are in one range with Jan-Dec data and the budget is another range with Jan-Dec data.

    The problem I have is that at the beginning of the year I know the budget for all 12 months, so my range is populated for Jan-Dec. The actual data is populated as we complete those months.

    Here's the rub: when caluclating totals for Oct, say, the formula to retrieve Q4 data needs to be smart enough to NOT include the November and December budget amounts, which are already populated in the table.

  21. Suvasini says:

    how can I do the same using SQL query?plz help

  22. […] Find Quarterly Totals from Monthly Data [SUMPRODUCT Formula] | Chandoo.org - Learn Microsoft Excel O… […]

  23. Rohit says:

    How do we use this for getting totals for the latest qtr? anybody?

  24. Rohit says:

    My challenge is I don't want to use a helper column. Want to derive the latest qtr and then average the numbers for that qtr . Ex this gives an error :

    AVERAGEIF((ROUNDUP(MONTH($A$2:$A$7)/3,0),(ROUNDUP(MONTH(MAX($A$2:$A$7))/3,0)),B2:B7))

  25. Lisa says:

    Hi

    I am arranging a spread sheet for work but am struggling with a date function. we have customers in our service for up to 2 yrs, however we have to calcuate the number of days they have been in service each quarter. For example Q1 will run from 15/01/15 to 06/04/15 but my customer could have joined on 03/09/14 ... i don't want to calulate all the days just the days in the quarter... which should be upto 91 days max. Can any one help at all?

  26. Mablazo says:

    Dear all

    I can see your formula and I think it works perfectly for what I want to achieve, ie pull quarterly figures from a range showing monthly data. There's only one problem. I cannot follow how the sumproduct formula is working in this case. Could anyone please help with an explanation on what is going on in that formula so I can hopefully be able to apply it.

    Thanks

  27. Olly says:

    Hi,

    I need to come up with a way to show the current quarters info, this would be run off the month end date.

    For example: If the month end date is 28.2 then I need to bring back Jan data and Feb data or if the end date was 31.3 I would need to total Jan, Feb and Mar data.

    I am thinking of creating unique references such as the quarter plus which month it is in the quarter ie if it was feb, the unique reference would be Q12 (Q1 for the quarter and 2 for the month as it is the 2nd month in the quarter). Would I need to use an index or offset formulae.........

    Any help would be appreciated.

  28. Hesham M Dabbas says:

    Greetings,
    Can we make this a little more involved just month and sales results.
    What if I have the following columns:
    Vendor Name
    Market
    Line of Business
    Month
    Sales
    Now I want to calculate the average quarterly sales by vendor, Market, and Line of Business

  29. Lyndon Dickson says:

    Im a little confused, I have the following table of sales

    Sales Sheet
    ColA=dates(dd/mm/yyyy)
    ColE=amount(total amount of sales in $)

    eg

    A E
    11/02/2020 $20.00
    01/01/2020 $15.00
    03/12/2020 $16.00
    05/07/2020 $23.00
    etc etc

    Report Sheet
    I want to report the running total of sales for each quarter and update the figures here as more get added

    Cell B2= Quarter1 total
    Cell B5= Quarter2 total
    Cell B8= Quarter3 total
    Cell B11= Quarter4 total

    How do I read the Sales Sheet column A selecting all dates for each quarter and sum total them in The Report sheet. I have tried mucking about with your formula but I just keep getting errors, any help much appreciated

  30. Shilpa says:

    I have problem Statement, my data are monthly i need to do comparison at QTD level say i am second quarter May (so my data should only pick April and May total) and( when in June it should pick Apr+ May +June) - can i your help on this
    Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    1 2 3 4 5 6 7 8 9 10 11 12

Leave a Reply