Average of a set of numbers, excluding empty cells (but including cells with a value of zero)

Hi, I have two tables in my spreadsheet (a personal budget) showing all my expenses spread over time.  In the first table, each column is a month and year, each row is a type of expense (gas, rent, groceries, etc).
October 2013
November 2013
December 2013
February 2014
Income
3000.00
3200.00
2800.00
Gas
85.00
95.00
75.00
Rent
1200.00
1200.00
1200.00
Groceries
110.00
130.00
150.00
Eating Out
92.00
76.00
80.00
Clothes
0.00
90.00
30.00
The second table is this month's expenses so far (I enter the figures for "X Month, So Far" in a third table, which doesn't factor in here).
December 2013, So Far
Average +/-
Income
2800.00
-200.00
Gas
75.00
-15.00
Rent
1200.00
0
Groceries
150.00
+30.00
Eating Out
80.00
-4.00
Clothes
30.00
-15.00
I want the correct formula for the Average +/- column.  I want it to calculate the monthly average for that particular type of expense, and then calculate the difference from this month's expenses so far.  The key is that I want it to add all the sums from a particular row with any value in their cells, even if it's zero. For instance, all of the examples above would divide the sums by two - even the row for Clothes, which has a cell with 0.00, but I would need that to count as a value. 
Also, when calculating the average, I would want the formula to exclude the current month, which is entered automatically in the next column.
I would need a formula I wouldn't have to change every month.  Can you help?

Hi sk,
"The key is that I want it to add all the sums from a particular row with any value in their cells, even if it's zero. For instance, all of the examples above would divide the sums by two - even the row for Clothes, which has a cell with 0.00, but I would need that to count as a value."
What you've described is the default condition for AVERAGE over a range of cells—any cell containing a numerical value is included, and cell that is empty or contains a text value is ignored. Here are some examples:
Creating a constant formula that will ignore the current (and future) month(s) can be done by ensuring that the amounts in the current month are seen as Text, rather than as numbers, as I've done in column C of row 6.
This can be done using a formula to transfer amounts from the 'third table' you mention to the first table in your example (showing monthly expenses for earlier months and partial totals for the current month). The formula would use IF to add text to the begining or end of the totals IF the column was for the current month, but to transfer of=nly the monthly totals for previous months.
=IF(earlier-month,"xx"&formula,formula)
Both instances of formula are the same—whatever formula you are currently using to transfer the amounts to this tabe.
An alternate method would be to add a second header row to the top of the forst table, and place checkboxes into thoes cells. Check the box when you want to incude that column's values in the averages.
For this method, AVERAGE would be replaced with AVERAGEIF, with the 'IF' condition a simple reference to the row of checkbox cells. As each month passed, the only change needed would be to check the box in the just-passed month's column.
Regards,
Barry

Similar Messages

  • Getting the average of a set of numbers, confused by file IO, please help!

    What i need to do is get the average of a set of numbers, the problem is that i am reading these numbers in from files in different directories where each file returns a number, and the average for the directory is the numbers for each file in that directory added together and divided by the number of files in that directory.
    public static HashMap readDir(File path, HashMap map) throws IOException{
            File files[] = path.listFiles();
            float totalForDirectory = 0;
             int common = 0;
             int count = 0;
                    if(files != null && files.length > 0) {
                              for(int i=0; i<files.length; i++) {
                                    if(files.isDirectory()) {
    readDir(files[i], map);
    } else {
    //trying to count the number of files in the directory
    count++;
    totalForDirectory =(total(common, totalF1(), totalF2(files[i])));
    readFile(files[i]);
    //will contain pathname, and the average
    map.put(path.getCanonicalPath(), totalForDirectory);
    return map;
    In the above code, totalForDirectory contains the number for each file, i want to add together the result of this variable for each file, "file[i]" in the directory, and divide that by the number of files in that directory.
    Id appreciate any help
    Thanks

    What you want, It seems to me, is a recursive routine (for directories) which returns both a total and a filecount. Then these can be totalled at each level (togther with the count for each file).
    Probably the best approach is to pass a small object in which the totals are accumulated.
    Define a class something like:
    public class Accumulator {
       int count;
       int total;
       public double mean() {
          return total / count;
      public void add(Accumulator add) {
         count += add.count;
         total += add.total;
       public void add(int numberFromFile) {
          count++;
         total += numberFromFile();
      }Create an instance of this at the start of your scan directory method, and pass it when you call make the recursion. At the end of the scan the method would use the first add method to add it's local totals to the hight level total.
    Obviously you create an Accumulator for the first scan directory call which becomes the grand total.

  • I am trying to set up a friends new iPad but am struggling with settings for her email accounts can anyone help me

    can someone help with the email settings for the email accounts on this iPad.? Or tell me what you would expect the default settings to be. currently we mail is a virgin.net account

    Please see: http://help.virginmedia.com/system/selfservice.controller?CMD=VIEW_ARTICLE&ARTIC LE_ID=2979&CURRENT_CMD=SEARCH&CONFIGURATION=1001&PARTITION_ID=1&USERTYPE=1&LANGU AGE=en&COUNTY=us&VM_CUSTOMER_TYPE=Cable for details.
    Regards,
    Steve

  • How do calculate the average of a group of percentages excluding percentages listed as zero on Numbers?

    Hey all
    This is driving me crazy!
    I need to calculate the average of a group of percentages excluding cells listed as '0%'.
    Please see screen print below, numbers highlighted need to be averaged, when the table is filled out correctly some will remain '0%' whilst others will have a value, I want the average to be calculated only using numbers with a value greater than '0'.
    FYI I am looking for the result to display in 'X2'
    Thanks :-)

    you can use the averageif() function. Here is a simple example to get you started:
    In this example the average if() function averages values that are non-zero
    C2=AVERAGEIF(A1:E1,"<>0",A1:E1)
    this is shorthand for select cell C2, then type (or copy and paste from here) the formula:
    =AVERAGEIF(A1:E1,"<>0",A1:E1)

  • MeasureExpression property - Is there a possibility to implement distinct count with exclude empty?

    I have a measure which needs to have distinct count aggregation with exclude empty.
    Is there a possibility to specify MeasureExpression property to achieve the same? I have set the aggregation of the measure to none and I have typed the following function,
    Count(Distinct(Column_name),EXCLUDEEMPTY)
    where as the measure reads 0(zero) upon processing. Is there any other way to achieve this?
    The data feed has nulls included too for the column which this is to be achieved, which cannot be modified in the data level.
    Regards,
    Kantha Girish

    Hi Kantha,
    According to your description, you want to implement the distinct count aggregation, right? In this case, we can use a query like
    count(nonempty([DimName].[HierarchyName].[LevelName].members,[Measures].[MyMeasure]))
    Here are some blogs about how to implemet distinct count aggregation, please refer to the link below.
    http://blog.sqltechie.com/2009/09/distinctcount-analysis-service.html
    http://richardlees.blogspot.com/2008/10/alternative-to-physical-distinct-count.html
    If I have anything misunderstood, please point it out.
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to set page numbers in scripts

    Hi,
        i want page numbers at bottom of page,
      please tell me how to set page numbers in scripts?

    Hi,
    In footer
    use this
    &PAGE& / &SAPSCRIPT-FORMPAGES&
    &PAGE& of &SAPSCRIPT-FORMPAGES&
    reward if it helps..
    regards,
    Omkar.

  • Sharepoint Online Bug: Document Set does not synchronize empty fields

    If in the properties of document set the general field is empty, it will not be synchronized with internal files that has this general field. Ie, all files can have own values for the general field. If the value in document set (in properties) is not empty,
    the synchronization works fine. This issue was tested in different sites from different account in Office365.
    How to reproduce the problem:
    1. In Document Set (DocSet1) I have general field (Field1).
    2. When I create DocSet1 item in the list, Field1 is empty.
    3. In DocSet1 I create file Doc1, also with Field1.
    4. Field1 in Doc1 and DocSet1 has to be synchronized (because it's general).
    5. When I change Doc1 file, put some text (Text1) for Field1,
    the value remains as
    Text1, but in that time Field1 in DocSet1 is empty.
    6. Field1 wasn't synchronized, it has different values in DocSet1 properties and in internal file Doc1.
    7. I go to DocSet1 and change Field1 to Text2, now the field is synchronized
    8. Field1 in DocSet1 and Doc1 is Text2.
    Why does it happen?

    Hi  ,
    According to your description, my understanding is that the updated Shared Column of   document item cannot synchronize with the Shared Column of the Document Set which is empty value.
    For reproduce your issue, I added two Shared Columns  “Description” and “E-Mail”  into my Document Set Content Type and added it to a document library . Then I created a new Document Set and left
     its two Shared Columns  “Description” and “E-Mail”  empty. When I created  a document item in the new document set and set values to the two Share Columns, the Description column was still empty but the “E-Mail” column was updated with
    new value.
    By default, if the Shared Column of  your Document Set  is empty, the Shared Column of the items in the document set should be empty and cannot be updated.
    For a good practice, I recommend  that you can set the value of Shared Columns in your document  set once your document set is created . For a workaround, you can hide Shared Column in the Edit
    Form. Here is the code you can refer to:
    <script type="text/javascript">
    $(document).ready(function(){
    HideFieldByInternalName("Coach");
    HideFieldByInternalName("Duration");
    HideFieldByInternalName("Locations");
    function HideFieldByInternalName(internalName) {
    $(".ms-formbody").contents().filter(function() {
    var regExp = new RegExp(internalName, "i");
    // match comment node containing internal field name
    return ((this.nodeType == 8) && (this.data.match(regExp)));
    }).parent().closest("tr").hide();
    </script>
    Reference:
    http://en.share-gate.com/blog/document-sets-making-your-metadata-shine
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • I have 9,046 emails in my inbox. I was messing with the setting to try to empty the inbox (100 emails) in one hit and somehow .... how do I remove them all.

    I was messing with the setting to try to empty the inbox (100 emails) in one hit and somehow I managed to get 9,046 emails in there.... how do I remove them all?

    Hans M wrote:
    If there is no other solution this Problem should be forwarded to the developers.
    Feel free to do that:
    http://www.apple.com/feedback

  • Finding an anomaly in a set of numbers

    Hi,
    I am trying to find an anomaly in a set of numbers. However, I'm struggling to implement it. Let's say I have the following numbers:
    1
    2
    3
    2
    1
    5
    1
    The number five would be the anomaly in this case.
    How would I be able to find this with a piece of java code?
    Thanks

    It is not homework. I am creating a peer assisted study portal. This is where students can submit work and other people can mark it. I was first thinking of counting the occurrences of each rating and then putting them in order and flag the lowest occurrences. When I put that into practise it didn't really work. The other option I tried was the following:
    for(int i = 0;i < originalResponses.size(); i++)
                int iValue = Integer.parseInt(originalResponses.get(i).toString());
                iValue = iValue + 2;
                if(iValue > 5)
                    iValue = 5;
                for(int a = 0; a < originalResponses.size(); a++)
                    int aValue = Integer.parseInt(originalResponses.get(a).toString());
                    System.err.println("aValue: " + aValue + " iValue: " + iValue);
                    if(aValue < iValue)
                        System.err.println(aValue + " is an anomaly");
            }The problem this threw was that lets say I have the following ratings in the database:
    5
    1
    1
    1
    1
    It would recognise that 5 is an anomaly but it would also recognise that 1 is an anomaly as it is comparing all numbers in all possible combinations.

  • How do I cerate an array with a set of numbers lets say 1 through 12 random order but no repeating.

    How do I cerate  an
    array with a set of numbers lets say 1 through 12 random order but no
    repeating.
    I know this should be easy but my brain wont work
    right now
    Solved!
    Go to Solution.

    OK, here's the handmade version.
    It is useful to know that arrays of clusters are sorted by the cluster order of the elements. Simply bundle random numbers with numbers 1-12 in a loop, create an array at the output tunnel, sort the array by the random number, and extract the number array. It will be shuffled.
    Message Edited by altenbach on 06-04-2007 09:20 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    shuffleArray.png ‏5 KB

  • Time Machine has simply stopped backing up any new files. No items set to be excluded, No error messages.

    I have a Macbook with OS X 10.6.8 and a 500GB external hard drive, which still has 208.5GB available. For some reason, Time Machine has simply stopped backing up any new files (documents, music, movies--anything). No items are set to be excluded from backups in Time Machine options except for the external hard drive itself. Also, no error messages appear, Time Machine seems to run just fine, but when I enter Time Machine, or look through the files on the hard drive, new files just aren't there. I am not very tech savvy, so I was not able to understand some of the answers people gave to similar questions on here. I did go to Pondini's website and followed as many troubleshooting instructions as I could understand (for example I did manage to do a full reset of Time Machine) but nothing changed. Do I just need to erase the entire backup drive and sart all over? If so, what will prevent this from happening again later on? Please help.

    Your TM drive liekly stopped backing up because it hit a series of bad sectors on the drive, to eliminate this all new drives should be Disk Utility > Zero Erased (one step below 7x in Lion) before use.
    Reducing bad sectors effect on hard drives
    Diversify your backups with bootable clones and archives on DVD's etc so your prepared for anything, including using a PC.
    only if you have too of course, but it happens, people just can't afford a Mac anymore.
    Most commonly used backup methods explained
    So make other backups, then Zero Erase teh TM drive and set it back up again and your problem should be resolved.
    If not, then it's data corruption on your boot drive!
    You'll know if it's data corruption on your boot drive, when you go to make the clone, it will hang too.

  • How do I update the TOC, after setting page numbers?

    I have set page numbers to run from Chapter 1. Actually on Page 9. but the TOC shows Chapter 1 starting at Page 7, which is not correct anyway.
    How do I cause the TOC to update? so the Chapter/Page numbers align ok.

    You need to say which version you are taking about, they behave differenetly.
    Peter

  • Subtotaling Sets of Numbers in a Column in Numbers 3.1

    I am trying to create subtotals in columns of data in Numbers 3.1. When I use the sum function it incorporates all of the data in the column and creates one sum for all the data, instead of allowing me to have individual subtotals for each set of numbers.  How do I get functions to give me these subtotals, instead of it totaling the entire column?

    total that subset of items by selecting that portion of the column and clicking on Sum under the Functions tab.
    Hi Kay,
    If I'm understanding correctly here is one way you can do that in Numbers 3.
    Select that portion of the column and you will see SUM in the lower left of your screen.  Drag that to the cell where you want the sum to appear.
    That's it!  No need to go back to Numbers 2.3 for this particular task.
    SG

  • TS1424 WHERE ARE THE 2 SETS OF NUMBERS NEEDED TO REDEEM ITUNES GIFTCARD AND HOW DO YOU KNOW - THE WHOLE BOTTOM OF THE CARD -SET OF NUMBERS/LETTERS DO I ENTER?

    How do I redeem gift cards? What are the sets of numbers/letters located how much of them do I enter for the bottom set?

    Welcome to the Apple Community.
    The following article(s) may help you.
    iTunes Card and Gift Certificate FAQ 

  • Search Option Set does not exclude Search Indexes

    Hello!
    We are running NW04 SPS15
    I've created a Search Option set, and in the "Search Index IDs (CSV)" property I've listed the one index Id I would like to search.
    My problem is that when I submit the search, TREX returns documents which are NOT in the list of Index ID's.
    Any suggestions??
    Regards,
    Ove

    Hi HC
    The settings you have entered in the search options set needs a place to be stored - a search component. Try creating a search component set with standard_search_input in Component for Basic Search Function and standard_search_scope (storage for the index restriction from the search options set) in Component for Search Options, use it along with the search options set in your search iview, and see if it works.
    Try swapping the position of the two search components in the search component set and notice the change in your search results.
    Regards,
    Martin

Maybe you are looking for

  • AppleScript do script file completely broken in Acrobat 9 Pro?

    After not being able to use Acrobat 8 at all because of this issue http://www.adobeforums.com/webx/.59b4b95a I plunked down another $170 hoping the issue would be fixed in Acrobat 9. But with Acrobat 9 Pro (9.0.0, OS X 10.5.5), calling do script file

  • Apple Menu and iTunes locked up

    iTunes was unresponsive and I couldn't use the Apple drop-down menu either. Force Quit showed no applications running. I could use the internet and got the information on resetting the MSC(?) by unplugging the power cord while holding the power butto

  • With the new IOS7 I get every email in my inbox. How can I limit to the last 50 like it was before the upgrade?

    With the new IOS7 I get every email in my inbox. How can I limit to the last 50 like it was before the upgrade?

  • How to interface ADAM 4060 in Labview 7.0 ?

    I got difficulties in interfacing ADAM 4060 with Labview 7.0. I have tested the device using Advantech ADAM Utility software and it working properly. So, its not hardware error or failure. However, when I want to interface it using Labview, I couldn'

  • Vcast media manager

    I'm sure this has been answered, but I couldn't find it in a search so...  Everytime I plug my HTC Incredible into my PC, Internet explorer opens up and takes me to Verizon's website and wants to download VCast Media Manager to my PC.  Trouble is, I'