Consulting

Results 1 to 5 of 5

Thread: Average and addtional conditions

  1. #1
    VBAX Regular
    Joined
    Apr 2017
    Posts
    77
    Location

    Question Average and addtional conditions

    I need some guidance. I am unable to determine if I need a formula for what I will describe below and which formula:

    Give me the average of these 4 rows, unless the average is 0 (zero), if the average is 0 (zero) enter this text (“this text” is an adjacent row).

    When I create a PivotTable, and if 0 is the result I will get a lot of questions about what does 0 indicate. I have 7 reasons why scores would be 0, and this type of data would be useful for analytics so I want it spelled out clearly.

    I have attached sample in Excel.
    Attached Files Attached Files
    Last edited by jnix612; 04-25-2018 at 06:17 AM. Reason: The website is not posting the text correctly.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Just use

    =IF(AVERAGE(B1:B4)=0,text_cell,AVERAGE(B1:B4))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    The cells being averaged seem to come from an external file with a 180 char name, not data in the sheet:


    =AVERAGE('\\cdc.gov\project\CGH_GID_Active\OD\STOP\STOP Master Data Lists\Country Assignment Lists 1-51 MASTER_pw protected.xlsx'!CountryAssignment[@[Technical_Rating]:[Commitment_Rating]])


    =IF(AVERAGE(B1:B4)=0,text_cell,AVERAGE(B1:B4))
    would make the formula about 400 char long, and isn't there a 253 char formula limit?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    VBAX Regular
    Joined
    Apr 2017
    Posts
    77
    Location
    @XLD, this worked. Thank you. I really thought it would be more complicated.

  5. #5
    VBAX Regular
    Joined
    Apr 2017
    Posts
    77
    Location
    @Paul thank you. I forgot my spreadsheet is formula heavy. I was able to use the basic version of what you typed.

Posting Permissions

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