Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Atlanta
    Posts
    568
    Thanks
    7
    Thanked 1 Time in 1 Post

    Pasted Null Value Not Null (97)

    I'm performing extensive data cleanup on a data set that has missing values. Imagine that I have two columns A and B where I write the following formula to convert imported percentages to numbers that Excel thinks are percentages. Note that I had to use dots in place of spaces since the HTML code underlying this forum igores extra spaces.

    .....A...... B
    1....90.... =if(A1="","",A1/100)
    2....80....=if(A2="","",A2/100)
    3............=if(A3="","",A3/100)
    4....70....=if(A4="","",A4/100)

    Now, if I convert the B column by Exit/Copy and Edit/Paste Special/Values, the cell in B3 should be empty and placing the cursor in cell B1 and pressing End Down, the cursor should stop in B2. However, it shoots down to B4, indicating that Excel does not think that B3 is empty. However, if I examine B3, I cannot see anything in it. Placing the cursor on B3 and hitting Del causes Excel to then see it as empty.

    If there any other way to write this formula to cause Excel to think that the pasted cells are, in fact, empty so that I can avoid having to scan over the data looking for "blank" cells and deleting them.


    Ronny
    Ronny Richardson

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Pasted Null Value Not Null (97)

    Tryy changing your formula to

    =IF(TRIM(A1)="","",A1/100).

    Or it might be worth your while to search and repalce spaces in column A with a blank ( "" ).

    Andrew C

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Pasted Null Value Not Null (97)

    The problem is that EMPTY means empty. A formula that gives a "null string" ("") is NOT empty it is a formula. Copy-paste special values turns the formula into a value. The value is a "null string ("") and it is still NOT empty: it has a string of length zero. Delete will empty.

    If you add a column © of numbers 1 to the end and then sort on column b, you can delete the nulls and then resort on column C (the original order), then delete column C to give you what you want.

    You could also write a macro to Blank the nullstrings if you do this a lot.

    Steve
    <pre>Option Explicit
    Sub BlankNulls()
    Dim rCell As Range
    For Each rCell In Selection
    If rCell.Value = "" Then
    rCell.ClearContents
    End If
    Next
    End Sub
    </pre>


  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Pasted Null Value Not Null (97)

    In addition to Steve's macro, there is a non-macro trick Servando Villalon explained in <post#=137498>post 137498</post#>, which applies to vbNullStrings which are not formulas, as you describe. Be sure you go through the all the Text-to-Columns dialogs before you click 'Finish'.
    -John ... I float in liquid gardens
    UTC -7±DS

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Pasted Null Value Not Null (97)

    That is better than either of my techniques: No coding, no extra columns, no sorting. Quick and easy.

    Another trick to keep in the back pocket!

    Steve

Posting Permissions

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