+ Reply to Thread
Results 1 to 8 of 8

TrimRefs give error when range is blank

Hybrid View

  1. #1
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,041

    TrimRefs give error when range is blank

    I'm trying to use trimrefs to improve efficiency.

    For example, replacing =SUM(A4:A8) with =SUM(A4.:.A8)

    I've noticed that if A4:A8 is blank, it gives a #Ref error rather than zero, which is a problem as in my intended use there's no guarantee that the range will be populated.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,440

    Re: TrimRefs give error when range is blank

    IFERROR, maybe?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  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
    30,872

    Re: TrimRefs give error when range is blank

    Delete Delete
    Last edited by JohnTopley; 04-04-2025 at 02:39 PM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,355

    Re: TrimRefs give error when range is blank

    Looking at the def of Trimrange..
    https://support.office.com/client/re...ain11.chm60727

    It looks like you need to have something in the range to get an answer back. Trying to trim a completely blank range doesn't fit with the:

    The TRIMRANGE function scans in from the edges of a range or array until it finds a non-blank cell (or value), it then excludes those blank rows or columns.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,440

    Re: TrimRefs give error when range is blank

    IFERROR does help .
    Formula: copy to clipboard
    =IFERROR(A1.:.A8,"")

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,928

    Re: TrimRefs give error when range is blank

    Try this in sum function.
    =SUM(IFERROR(A4.:.A8,0))

  7. #7
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,041

    Re: TrimRefs give error when range is blank

    Thanks guys. I was hoping that the trimrefs were able to handle it, but I guess IFERROR is the obvious solution.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,440

    Re: TrimRefs give error when range is blank

    You're welcome. Thanks for the rep.

+ 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. [SOLVED] Highlight the cells (verify) that give a SUM error on a column (specific range)
    By Alexander2020 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-10-2020, 03:10 AM
  2. Replies: 6
    Last Post: 03-01-2018, 12:16 PM
  3. [SOLVED] Ignore blank cell to give give non zero result
    By rehan0129 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-24-2018, 12:04 PM
  4. [SOLVED] why give me error #VALUE ... i need to give me the numbers from small to big
    By mena in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-22-2015, 10:11 AM
  5. Deleting rows in table give me run time error delete method of range class failed
    By jhuvba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2015, 04:37 PM
  6. Replies: 12
    Last Post: 09-19-2014, 10:18 PM
  7. Error Transpose With Blank in Range
    By ShareTheGlobe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-05-2013, 10:06 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