ChatterBank2 mins ago
Mathematics Problem
21 Answers
I'm in my mid fifties, and the furthest I got in Maths at school was O'level, which I just scraped past. I understand the principals of simple Maths, but I think I have mild discalculia, as I can never fix numbers in my head once I get past tens and units. I'm self employed and use a spreadsheet for my finances. I'd like to use some formulas, but don't even know how to begin beyond the simplest ones. I don't even know what branch of Maths I need to use.
The formula I'm stuck on goes like this; I run exercise classes in towns and villages nearby, but of course the classes don't run 52 weeks of the year. I need a formula that will count the number of weeks out of 52 that the class ran so that I can calculate mileage and room hire etc without having to physically run down the column with my finger, counting the number of classes.
I'd be grateful if someone could tell me what formula to use, and point me to the right branch of mathematics to find out for myself what the process behind the formula is - is it logic? algebra?
Thanks in advance
The formula I'm stuck on goes like this; I run exercise classes in towns and villages nearby, but of course the classes don't run 52 weeks of the year. I need a formula that will count the number of weeks out of 52 that the class ran so that I can calculate mileage and room hire etc without having to physically run down the column with my finger, counting the number of classes.
I'd be grateful if someone could tell me what formula to use, and point me to the right branch of mathematics to find out for myself what the process behind the formula is - is it logic? algebra?
Thanks in advance
Answers
Further to jim360's answer, if you have a column in your spreadsheet that has, for example, "YES" when the class was on, you can use a COUNTIF formula instead: COUNTIF( A1: A20," YES") - that will count all the cells with YES in, and saves having to create an extra "working out" column, and is easier to follow (I think).
16:09 Fri 11th Apr 2014
My first thoughts are that you can only really use a set formula if the circumstances do not change. If you have 452 weeks in a year and yet leave one out every now and again, then somehow the formula needs to pick up the missing ones, which are presumably fairly random.
Thinking about spreadsheets, which you mention, then if there is still a row for each week but an empty cell when a class did not run then I'm fairly sure one can count non-empty cells and maybe use that as a multiplier for whatever the cost of a class is.
pologies I don't know these things in detail off the top of my head and am a little busy at present, but I think the help function for the spreadsheet should give a formula for counting cells with something in them in a particular column or cell selection.
Thinking about spreadsheets, which you mention, then if there is still a row for each week but an empty cell when a class did not run then I'm fairly sure one can count non-empty cells and maybe use that as a multiplier for whatever the cost of a class is.
pologies I don't know these things in detail off the top of my head and am a little busy at present, but I think the help function for the spreadsheet should give a formula for counting cells with something in them in a particular column or cell selection.
If I understand the problem correctly there isn't a formula because the number of weeks the class doesn't run is arbitrary. However if you have a spreadsheet there may be a way to get around this. That will very much depend on the information in the spreadsheet, and how it's being presented. We'd need to know that before being able to proceed further.
What would probably needed is a sort of "IF" formula that would work along the lines of:
"=IF([class took place that week],1,0)"
This formula will output 1 if the class took place that week, and 0 if it did not. You can then go to the bottom of the column (or end of the row), and enter a formula that would be:
"=SUM([column])"
This would add up all the 1's and 0's together, and the answer would be exactly the number of weeks in which the class took place.
The starting point in this is how you tell excel whether or not the class took place. A cell that simply states "YES" if it happened, and "NO" if it did not, would do, and then the if formula would become:
=IF(C1="YES",1,0)
(assuming you've put the Yes or No in cell C1).
I hope this helps.
What would probably needed is a sort of "IF" formula that would work along the lines of:
"=IF([class took place that week],1,0)"
This formula will output 1 if the class took place that week, and 0 if it did not. You can then go to the bottom of the column (or end of the row), and enter a formula that would be:
"=SUM([column])"
This would add up all the 1's and 0's together, and the answer would be exactly the number of weeks in which the class took place.
The starting point in this is how you tell excel whether or not the class took place. A cell that simply states "YES" if it happened, and "NO" if it did not, would do, and then the if formula would become:
=IF(C1="YES",1,0)
(assuming you've put the Yes or No in cell C1).
I hope this helps.
It's probably simpler, yes. That post of mine was sort of a train of thought, really. That said, using YES and NO has the advantage of being more visual and wordy which may or may not be more helpful.
Anyway, the solution is one way or another to create a column of 1's and 0's where 1 means that the class took place that week and 0 means it didn't, and then use =SUM([first cell]:[last cell]) to add them all up. Whether you generate 1 or 0 by an IF formula or not is up to you.
Anyway, the solution is one way or another to create a column of 1's and 0's where 1 means that the class took place that week and 0 means it didn't, and then use =SUM([first cell]:[last cell]) to add them all up. Whether you generate 1 or 0 by an IF formula or not is up to you.
Further to jim360's answer, if you have a column in your spreadsheet that has, for example, "YES" when the class was on, you can use a COUNTIF formula instead:
COUNTIF(A1:A20,"YES") - that will count all the cells with YES in, and saves having to create an extra "working out" column, and is easier to follow (I think).
COUNTIF(A1:A20,"YES") - that will count all the cells with YES in, and saves having to create an extra "working out" column, and is easier to follow (I think).
Thanks all. My elder son did help one year, and I think he made an extra hidden column with 1's and 0's in - but he's a bit rusty and couldn't reproduce it. I understand that the formulas with IF in it might be useful - what type of maths is that? I was also thinking that on the weeks the class doesn't run, there will be a zero value as I won't have taken any money. So what formula can I use to count the zeros?
The "IF" equation is a logical test. Is a statement true or not? If Yes, output 1; if No, output 0.
To answer your other question, you needn't count the zeros as well. However you set up the 1's and 0's, or if you use countif, then to count the zeros you can just subtract the answer from 52. The formula for this would be "=52-[cell with the number of weeks you did play]".
To answer your other question, you needn't count the zeros as well. However you set up the 1's and 0's, or if you use countif, then to count the zeros you can just subtract the answer from 52. The formula for this would be "=52-[cell with the number of weeks you did play]".
Thanks all - I discovered how to use COUNTIF - some of the values were constant, in which case I used something like COUNTIF(,25) and some values varied, in which case I used < 0. I'm pleased that I worked how to do it rather than someone do it for me and not be able to adapt it. I have a nice neat spreadsheet now.