+ Reply to Thread
Results 1 to 7 of 7

VBA - Array that ignores zero's and blanks?

  1. #1
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    VBA - Array that ignores zero's and blanks?

    Hi All,

    Is it possible to have an array that ignores 0's and blanks?

    Current problem i'm facing, i have a list of numbers (which can change daily - with the 0's and blanks it doesn't exceed 2,000 rows) I want to be able to take the array of Col A and for it to produce a string i.e. '290','5000','24012' etc

    I need each number to be separated with ','

    In the attached file the outcome is in Cell D2 (Ignoring 0's and blanks)

    Any help with this would be great,

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this ‼


    A single codeline starter demonstration :

    PHP Code: 
    [D2] = "'" Join(Filter(Evaluate(Replace("TRANSPOSE(IF(A2:A#,A2:A#))""#", [A1].End(xlDown).Row)), FalseFalse), "','") & "'" 
    ► Do you like it ? ► ► So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: VBA - Array that ignores zero's and blanks?

    Thanks for the quick reply Marc,

    Sorry - i Don't quite understand your response? I get type mismatch

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    I can't reproduce your issue as it works like a charm on my side with your attachment …

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,483

    Re: VBA - Array that ignores zero's and blanks?

    Quote Originally Posted by Marc L View Post

    I can't reproduce your issue as it works like a charm on my side with your attachment …
    It works for me as well.



    Here is another one-liner for you to consider...
    Please Login or Register  to view this content.
    By the way, using apostrophes around your numbers is somewhat problematic as Excel takes that leading apostrophe as a "here comes a text string" marker and does not physically display it.
    Last edited by Rick Rothstein; 12-23-2019 at 02:59 PM.

  6. #6
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: VBA - Array that ignores zero's and blanks?

    Apologies, my mistake.

    This does indeed work! Thank you!

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Thanks for the rep' !

    You should test both ways with a zero in A2 …

+ 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. Replies: 1
    Last Post: 08-06-2019, 10:43 PM
  2. Replies: 9
    Last Post: 05-22-2018, 10:37 AM
  3. Sumifs formula that ignores text and blanks in the criteria column
    By sjs4952 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-30-2018, 02:48 AM
  4. Rolling average using offset that ignores blanks
    By jd33a in forum Excel General
    Replies: 1
    Last Post: 09-07-2017, 05:14 PM
  5. Replies: 5
    Last Post: 05-07-2015, 06:12 AM
  6. [SOLVED] Due dates formula in conditional formatting that ignores blanks
    By ciapul12 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-31-2013, 08:48 AM
  7. Transfer based on drop down menus that ignores blanks
    By rowlandjp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2013, 10:46 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