+ Reply to Thread
Results 1 to 3 of 3

NULL vs EMPTY vs 0-length string

  1. #1
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    NULL vs EMPTY vs 0-length string

    I've got a question for the real experts here. Can any one of you help me understand the difference between all of these, when checking a cell for no content?
    Please Login or Register  to view this content.
    I've been using this program for a long long time, and everytime I have to check something like this I get very annoyed because I've always run into anomalies with regard to these statements. I am currently putting together a knowledgebase for a student and one of my routines has to check a cell for no content. And to cover all the bases of Excel ""quirks"", this is the code I'm using:
    Please Login or Register  to view this content.
    Can someone tell me why I'm not trusting Excel to be reliable? I've run into this in the past. Is it just because I'm not a professional developer and don't know every little detail about this program? In this example, rstart has been set in the code, and declared as a range object.

    thanks.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: NULL vs EMPTY vs 0-length string

    isnull()
    Do not use IsNull on a range. Use it on a Variant variable. It returns TRUE iff the variable contains no valid data.

    = ""
    For a cell, returns TRUE iff the cell has no content, or the content is the null string. This will be TRUE for an empty cell and also true if there is a formula that returns "" such as
    =IFERROR(VLOOKUP(A1,B2:F2,5,TRUE),"")

    isempty()
    On a cell it returns TRUE iff the cell has no content, that is, no value and no formula. On a Variant variable it returns TRUE iff the variable has not been initialized.

    = null
    Do not use Null to check the value of a cell. Use it on a Variant variable. This
    Please Login or Register  to view this content.
    is equivalent to

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 08-30-2020 at 10:33 PM.

  3. #3
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: NULL vs EMPTY vs 0-length string

    what a very useful post. thanks so much jazzer! I assume you play guitar.

+ 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] Formula to return empty string instead of null when column table is empty
    By jaryszek in forum Excel Formulas & Functions
    Replies: 26
    Last Post: 02-14-2020, 06:37 AM
  2. Replies: 12
    Last Post: 02-07-2020, 03:51 AM
  3. [SOLVED] Replace empty string with null
    By anteagles20 in forum Excel General
    Replies: 7
    Last Post: 04-08-2014, 07:16 AM
  4. [SOLVED] Shorten string length if exceeds 31 characters (max sheet name length)
    By r2fro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2014, 05:57 AM
  5. Length of the longest consecutive data series with values not null
    By jacknobody in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-24-2013, 09:42 AM
  6. Find a cell that has a null value, and replace with an empty string.
    By skania in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2013, 12:49 PM
  7. If null be empty
    By hawkins in forum Excel General
    Replies: 1
    Last Post: 06-22-2012, 12:48 PM

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