+ Reply to Thread
Results 1 to 12 of 12

If Else finds Average

Hybrid View

  1. #1
    Registered User
    Join Date
    07-01-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Unhappy If Else finds Average

    Hello all,

    Is it possible for a macro to know when to find the average by using if..else statement and for loop? I have 4 criteria before the macro computes the average. Anybody? Help is really needed here.

    Thanks in Advance

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: If Else finds Average

    No, it is not possible without more details

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: If Else finds Average

    blabla,

    Please explain in more detail.

    Please attach your workbook, by clicking on the New Post button, then scroll down and see the Manage Attachments button.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: If Else finds Average

    Hi blabla;

    The short answer is yes it's possible. But nobody can help you write the macro without more information.

    Some of the things people need to know:
    1. How is the macro triggered? By a validation? By a button? By a menu item? or how?
    2. What are the tests to decide whether to calculate the average?
    3. What will the macro do with the answer after it calculates it?
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  5. #5
    Registered User
    Join Date
    07-01-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Arrow Re: If Else finds Average

    Hi all,
    Sorry for the limited information given. The sample i attached will explain to u in details. Hope you guys can help me out. Thanks in advance
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: If Else finds Average

    Hi blabla;

    I can not figure out what you want done.

    I think you want these steps.
    1) The user will enter criteria In N23:N27.
    2) The user clicks "Average"
    3) The macro will go to another workbook and look for the "testname" and average the #s it finds in that other workbook. A sample of the other workbook is in K34:O39.

    If the #s to average are in the other workbook, how can a macro in this workbook do it without the other workbooks name?
    Where do yo want the result put?
    What are the other criteria besides testname for?

  7. #7
    Registered User
    Join Date
    07-01-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: If Else finds Average

    the another workbook name is average.xls where the result should be. I want to find the average value of each testname FTL according to their month, week, result and service. So the criteria besides testname is month, week, result and service? Di you roughly get what i mean? Isit possible to use DAVERAGE? Can DAVERAGE include another workbook?

  8. #8
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: If Else finds Average

    The DAVERAGE should be able to use another workbook, but I still can not understand how you expect it to work.
    When the user enters testname, month, week, result2, and service, there is no problem finding the correct FTP DL, but I don't see what there is to average. Maybe if you provided average.xls it would make more sense to me.
    Last edited by shg; 07-07-2010 at 08:35 PM. Reason: deleted spurious quote

  9. #9
    Registered User
    Join Date
    07-01-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: If Else finds Average

    Sorry for the lack of information. Thanks for your patient.

    Quote Originally Posted by foxguy View Post
    When the user enters testname, month, week, result2, and service, there is no problem finding the correct FTD, but I don't see what there is to average. Maybe if you provided average.xls it would make more sense to me.
    Once the macro find the correct value of FTD, the macro will then average all data that contains the same criteria. What i gave u in sample.xls(changed to average.xls) is not even half of the data.i have a few thousands of rows and there is several testname. Each testname may repeat a few times. Each testname has a FTD value depending on the speed of network. We did the testing almost everyday. And because of this we have month and week. What i want to be done is to find each testname FTD value for each month and week. In addition, i need the result2 to be 1 and service FTD.

    For e.g.
    IF testname = Central, service = FTD, Month = 12, Week = 45, Result2 = 1 Then
    macro will compute the average of FTD in column K of average.xls
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: If Else finds Average

    I'm sorry blabla;

    I still can not see what you want averaged.
    Try making more sheets:
    Sheet 1 - shows blank user entry.
    Sheet 2 - shows what it looks like after user types in something
    Sheet 3 - shows results after user clicks button.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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