+ Reply to Thread
Results 1 to 23 of 23

Determine item count from the Average function?

  1. #1
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Determine item count from the Average function?

    Is there function in Excel which would put the count of numbers entered into an Average function in a cell? For instance, if I have an Average function in cell A1 that has 10 numbers; it would put 10 in say cell B1.

    I haven't been able to find any info on this searching, so I thought I poll the experts in the forum. Is this possible?

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Determine item count from the Average function?

    The only such function I am aware of is the COUNT() function. https://support.office.com/en-us/art...4-d23bf411294c
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Determine item count from the Average function?

    That would work if I had the 10 numbers in a cells and using the average for the cell range. I don't have a reason to enter the numbers into a worksheet, it's just as easy to put the number directly into the Average function. I just note the last reference in the Average function and enter it in the quantity column. I just was curious if I could use Excel to cut out that step. Thanks for the reply.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Determine item count from the Average function?

    Maybe Im missing something here, but if you are working out the avg of a range, you are using the =average() function, correct?

    If so, that would alreadyt have a range specified - why cant you just use that range for the count() function?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Determine item count from the Average function?

    It's just as easy to enter the numbers directly into the AVERAGE() function -- IF the only thing you would ever need to do with those numbers is compute the average. However, if I may say so, you have just discovered a reason to enter the numbers into a range and reference that range. You want both the AVERAGE() and the COUNT() of the numbers. At this point, I expect it will be easier to enter the numbers into a range and then invoke both the AVERAGE() and the COUNT() functions on that range.

    If you still prefer, you can enter =AVERAGE(list of numbers) and then enter =COUNT(same list of numbers), and not enter the values into their own range, but that seems like it will be less convenient.

    I guess what it boils down to -- there is no way to get the AVERAGE() function to also output the count -- which is the real answer to the question in the OP.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Determine item count from the Average function?

    Another option, which is actually a bit of a step backwards, would be to SUM the range, COUNT the range, then use those 2 values to work out the AVERAGE

  7. #7
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Determine item count from the Average function?

    The numbers are entered directly in to the formula like this =AVERAGE(3012.25,3009,2990,2989.50), not into cells on the worksheet - there is no need for them other than in the function. I just make a mental note whether the last one entered was "Number 4" or "Number 24" and enter that in the quantity cell manually. It just struck me that I wondered if there was an attribute for Average in Excel that would output the number count into a cell since the function knows it.

    I couldn't find anything about it and and from your replies I think it's safe to call off my search. Thanks all for your replies.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Determine item count from the Average function?

    aahh well thats a little piece of info that you neglected to mention (or that we did not pick up on)

    This should work for you...
    =LEN(FORMULATEXT(a1))-LEN(SUBSTITUTE(FORMULATEXT(a1),",",""))+1

  9. #9
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Determine item count from the Average function?

    @Ford
    FormulaText() isn't available in 2010, which is what's in the OP's profile.

    @aquixano
    Maybe I'm just being dim, but I don't understand why it isn't easier to put the numbers into a range then average that range (or average individual cells within the range). If the numbers aren't going to change, then there's no point in using Average() - you might as well just enter the answer (3000.1875). If the numbers do change, then entering them into cells which the Average function references would allow you also to use Count, as suggested.
    (Alternatively, if Ford's suggestion works for you, please update your profile to show which newer version of Excel you're using.)
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  10. #10
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Determine item count from the Average function?

    Most of the entries are single – quantity 1, and a single price. The “exceptions” will vary from two to 25 entries, so entering into a range would require making the range definition dynamic, which I could do, but the workbook already calc’s a little slow for my taste, so I don’t think adding the additional calculations are worth it. I’ll just keep doing it the way I currently do. My original question was really about if there happened to be some feature unknown to me that adding an argument to the function would give me the count.

    I am still on Excel 2010 so the profile is correct. Although I did recently post a question about upgrading since I recently switched to Windows 10. My take away from the comments I received was stick with 32bit unless I had reason requiring 64bit and if 2010 still served me, don’t upgrade. So I decided to leave well enough alone.

    Thanks everyone for all the comments.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Determine item count from the Average function?

    You can run the latest version of Office in 32-bit - I am running Office 365 in 32-bit on a 64-bit Windows 10 machine, so that piece of advice is nonsense. Running Office in 64-bit can cause more backward compatibility issues, it's true, especially with VBA, but it's not mandatory.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  12. #12
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Determine item count from the Average function?

    I do use VBA a lot, and backward compatibility was another point mentioned that cooled me to the upgrade idea. Thanks.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Determine item count from the Average function?

    Can you provide a sample workbook for this issue?

  14. #14
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Determine item count from the Average function?

    If your referring to my original question about Average, unfortunately the workbooks contains private information that I cannot share. However, if that is what your asking about, I could give an example to illustrate. If your not referring to that issue, can you please clarify? Thanks.

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Determine item count from the Average function?

    I am referring to the issue you are asking for help with, as per your thread title.

    When we ask for a sample workbook, we do not expect you to share sensitive data. We expect a desensitised (dummy) dataset (small) that reflects the real data enough for us to be able to help solve the issue.

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Determine item count from the Average function?

    OK, well in the absence of a response, I hope that I have understood correctly.

    The attached uses a UDF sourced here: https://stackoverflow.com/questions/...-a-text-string

    It's then a case of using the UDF (GetFormula) in this formula to effect the count:

    =LEN(SUBSTITUTE(MID(GetFormula(A2),10,99),")",""))-LEN(SUBSTITUTE(SUBSTITUTE(MID(GetFormula(A2),10,99),")",""),",",""))+1
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Determine item count from the Average function?

    Understand. Just to be clear / not waste peoples time I wasn't asking about a solution to an issue as much as asking if there was an unknown feature relative to the Average function that would put the number count in a different cell besides the Average. I've created a mock-up workbook with the Average price in D2 and the Total Qty in C2, which I note from the Average function once I'm done entering the numbers in the formula (see picture beneath the function). Since Excel has to "know" the count is 22 to calculate the average, I was just wondering if that piece of info was available somehow. It's not a problem to keep doing what I do, I just wondered if I could do it better using some hidden (at least to me) Excel feature. It's now apparent such a feature doesn't exist. Thanks for you time and interest to inquire.
    Attached Files Attached Files

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Determine item count from the Average function?

    I've provided a suggestion above. There is no native feature that does what you want.

  19. #19
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Determine item count from the Average function?

    Very interesting - Thank you! I've incorporating your formula into a worksheet change macro as follows:

    Please Login or Register  to view this content.
    This will work if I can make your formula relative in the macro - that's something that's given me problems in the past. How do I adjust the code to make the code create a relative address vs.an absolute one?

    Thanks again for your help!

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Determine item count from the Average function?

    That I don't know, but if you like, I can move this to the VBA section where you can get the help you need.

  21. #21
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Determine item count from the Average function?

    That's ok - I've found it before, although not sure I ever did it with an array formula. If I can't find the answer after doing some legwork, I'll post a new question in the VBA section (assuming that is acceptable). Let me know if it would be more appropriate under forum rules to just have it moved now. Thanks again for the formula.

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Determine item count from the Average function?

    No, on reflection a new thread in the VBA section with an appropriate title would be better.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  23. #23
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Determine item count from the Average function?

    Solved marked - Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. function to count the average, check if not empty, then count
    By doudou in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-06-2019, 06:55 AM
  2. Trying to determine if a list box item is selected
    By CWicklund in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2017, 11:01 AM
  3. Replies: 5
    Last Post: 03-01-2017, 05:41 PM
  4. [SOLVED] Function to count the number of times an item appears , fulfilling conditions
    By Aretradeser in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-16-2016, 10:55 AM
  5. function to count and/or average when data changes daily
    By chavez000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-23-2014, 09:19 PM
  6. [SOLVED] MODE function does not count if only one item
    By sealpino in forum Excel General
    Replies: 4
    Last Post: 12-04-2012, 09:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1