+ Reply to Thread
Results 1 to 6 of 6

Eliminating 0 values for blank filtered records

  1. #1
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Eliminating 0 values for blank filtered records

    Hi Crew,

    A member asked few days ago how to generate a list of records based on a lookup criteria that appears several times on the lookup column. I you use Vlookup you'll only get the first hit, so I thought that arrays would be the answer. Of course, I was lazy and recommended him to just use AutoFilter.

    Refer to the attached:
    You see if you select any value on C19 other than "CAB", you'll be fine. However, under the Sub column for those items that are blank, I'm getting a 0. Is there a way to remove the zero and to show what it actually is, which is Blank ""?

    Thank you
    Attached Files Attached Files
    Last edited by ron2k_1; 10-30-2010 at 12:06 PM.
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

  2. #2
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    157

    Re: Eliminating 0 values for blank filtered records

    The formula cells under the "Price" heading have a Custom format that displays the formula's zero as a dash.
    If you apply the same format to the formula cells under the "Sub" heading they too will display the formula's zero as a dash.

    If that is not an acceptable solution then your formula under the "Sub" heading in D22 could be changed to...
    Please Login or Register  to view this content.
    which tests for the blanks in D3:D14 then forces the return of a blank rather than a zero.

    BTW: The sheet has the defined name "List" (B3:B14) which could be used in the formulas under the "Price" and "Sub" headings.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Eliminating 0 values for blank filtered records

    @ron2k_1, goes without saying you should be looking to avoid double evaluation of any Array.

    For the text strings D22 onwards simply encase the INDEX within a REPT call

    Please Login or Register  to view this content.
    Note: here there's no need to bother with the pre-emptive COUNTIF we can simply use contents of adjacent cell as our test (which has already conducted this test)


    Regards your unique list... you needn't worry about double evaluation here given you can restrict your DNR to ignore the #N/A

    Please Login or Register  to view this content.
    Modify Data Validation source for C19 from the INDIRECT to:

    Please Login or Register  to view this content.
    there is no need for UniqueValidationList nor do you need the formula in J2

  4. #4
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    157

    Re: Eliminating 0 values for blank filtered records

    Quote Originally Posted by DonkeyOte View Post
    For the text strings D22 onwards simply encase the INDEX within a REPT call
    I've not seen this trick before.
    I've done what appears to be the same with the T function.
    Just wondering if there is any difference?

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Eliminating 0 values for blank filtered records

    REPT would return any non-blank/non-error as a text string (text, numbers, logicals) whereas T would only return strings (either/or may be preferable).

    As a function REPT obviously has "number of times" so can be useful for padding etc - ie the equiv. to VBA String Function.

  6. #6
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Eliminating 0 values for blank filtered records

    Hey! Wicked!

    Neat tricks I've learned today! I must confess, as beaunydal I have never used REPT before. Thank you you saved me lots of turn arounds with the unique list process and the validation list.

    I almost gave up modifying the array formula on D22 down. To eliminate the zeroes I guess I could've used custom text format to "", but for educational purposes it was a pleasure to have received your assistance.

    I'll try to locate that post now and attach the workbook, or make reference to this thread.

    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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