+ Reply to Thread
Results 1 to 8 of 8

AVERAGE with double quotes ("")

  1. #1
    Registered User
    Join Date
    07-18-2007
    Location
    Seattle, WA, USA
    MS-Off Ver
    2016
    Posts
    42

    AVERAGE with double quotes ("")

    Hi everyone. I'm looking for a way to make this work:

    =AVERAGE("","",5,"","")

    That function returns a #VALUE error, presumably because Excel treats the double quotes as strings and it doesn't know how to handle them. But I don't want to replace them with zeros, either, because then my average becomes 1.25 instead of 5.

    Basically what I'm doing is I have an AVERAGE function that has formulas (VLOOKUPS) that check other sheets for values that may or may not find anything. If it doesn't find anything, then it returns the double quotes for the value to average. If it does, then it returns the value to be averaged. I've evaluated the formula, and the very last step looks exactly like what I've shown above with the double quotes, but it chokes at the end.

    Unfortunately, I don't think using an array here is going to work either.

    Any help would be appreciated.
    Last edited by aikorei; 07-12-2017 at 04:14 PM. Reason: Updating to show that issue is solved.
    -Aikorei

  2. #2
    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,734

    Re: AVERAGE with double quotes ("")

    You might need to use the AVERAGEIF finction.

    Will you please attach a sample Excel workbook?

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,181

    Re: AVERAGE with double quotes ("")

    Either set the non-Value fields to null,"" or 0 and use

    =AVERAGEIF(A1:A5,"<>")

    or

    =AVERAGEIF(A1:A5,"<>0")


    And please update your profile with Location and Office version

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: AVERAGE with double quotes ("")

    This should return 5
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    07-18-2007
    Location
    Seattle, WA, USA
    MS-Off Ver
    2016
    Posts
    42

    Re: AVERAGE with double quotes ("")

    I appreciate the quick responses! I've tried to attach a file. Not sure if it worked or not...

    Anyway, the problem I'm having is that I'm pulling from multiple sheets in the workbook, so using an AVERAGEIF would be tricky, as would ranges of any sort (though correct me if you see a better way). The full formula looks like this:

    =AVERAGE(IF(ISERROR(VLOOKUP($A2,'2013ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2013ASP'!$A:$F,COLUMN(),FALSE)),IF(ISERROR(VLOOKUP($A2,'2014ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2014ASP'!$A:$F,COLUMN(),FALSE)),IF(ISERROR(VLOOKUP($A2,'2015ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2015ASP'!$A:$F,COLUMN(),FALSE)),IF(ISERROR(VLOOKUP($A2,'2016ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2016ASP'!$A:$F,COLUMN(),FALSE)),IF(ISERROR(VLOOKUP($A2,'2017ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2017ASP'!$A:$F,COLUMN(),FALSE)))

    Thanks again for the help.
    Attached Files Attached Files
    Last edited by aikorei; 07-12-2017 at 01:50 PM.

  6. #6
    Registered User
    Join Date
    07-18-2007
    Location
    Seattle, WA, USA
    MS-Off Ver
    2016
    Posts
    42

    Re: AVERAGE with double quotes ("")

    Quote Originally Posted by AlKey View Post
    This should return 5
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I did try this within my formula, crossing my fingers along the way, but no luck. It looked like this:

    =AVERAGE({IF(ISERROR(VLOOKUP($A2,'2013ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2013ASP'!$A:$F,COLUMN(),FALSE)),IF(ISERROR(VLOOKUP($A2,'2014ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2014ASP'!$A:$F,COLUMN(),FALSE)),IF(ISERROR(VLOOKUP($A2,'2015ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2015ASP'!$A:$F,COLUMN(),FALSE)),IF(ISERROR(VLOOKUP($A2,'2016ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2016ASP'!$A:$F,COLUMN(),FALSE)),IF(ISERROR(VLOOKUP($A2,'2017ASP'!$A:$F,COLUMN(),FALSE)),"",VLOOKUP($A2,'2017ASP'!$A:$F,COLUMN(),FALSE))})
    Last edited by aikorei; 07-12-2017 at 01:50 PM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,181

    Re: AVERAGE with double quotes ("")

    Different approach:

    in G2

    =IFERROR(SUMPRODUCT(SUMIF(INDIRECT("'"&Sheets&"'!A:A"),$A2,INDIRECT("'"&Sheets&"'!B:B")))/SUMPRODUCT(COUNTIFS(INDIRECT("'"&Sheets&"'!A:A"),$A2,INDIRECT("'"&Sheets&"'!B:B"),"<>")),0)

    Copy down

    Replace B:B with C:C, D:D as you copy across

    Named range called Sheets
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-18-2007
    Location
    Seattle, WA, USA
    MS-Off Ver
    2016
    Posts
    42

    Re: AVERAGE with double quotes ("")

    Quote Originally Posted by JohnTopley View Post
    Different approach:

    in G2

    =IFERROR(SUMPRODUCT(SUMIF(INDIRECT("'"&Sheets&"'!A:A"),$A2,INDIRECT("'"&Sheets&"'!B:B")))/SUMPRODUCT(COUNTIFS(INDIRECT("'"&Sheets&"'!A:A"),$A2,INDIRECT("'"&Sheets&"'!B:B"),"<>")),0)

    Copy down

    Replace B:B with C:C, D:D as you copy across

    Named range called Sheets
    Awesome, thanks JohnTopley. That looks like it will work - much appreciated!

+ 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. Saving spreadsheet as text without unwanted double quotes (")
    By Tempe_VBA in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2014, 10:14 PM
  2. [SOLVED] How can I copy "=Average(A1:A2)" and paste as "=Average(A3:A4)" in next space in column?
    By matt_m_is_me in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 01-27-2014, 11:02 AM
  3. want to get values with double quotes " "
    By katakam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-05-2013, 01:30 AM
  4. Replies: 2
    Last Post: 07-08-2013, 10:02 PM
  5. Using "Append", adds unwanted double quotes. How to remove them?
    By thelisa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-12-2013, 09:35 AM
  6. double quotes within double quotes? .Value = "=IF(A2<=0,"Hit","Miss")"
    By bassima in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2011, 09:10 PM
  7. Replies: 2
    Last Post: 07-11-2007, 06:35 PM

Tags for this Thread

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