+ Reply to Thread
Results 1 to 13 of 13

INDEX and AGGREGATE to ignore 0's and functions

  1. #1
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    INDEX and AGGREGATE to ignore 0's and functions

    I am currently using the following formula to join text based on the contents of relevant cells. The formula comes from a different thread, and was proposed by JeteMc.

    Please Login or Register  to view this content.
    I have also included a test sheet.
    What i need the function to do, is ignore 0's and functions, meaning it should only join text from cells with number values.

    Thank you!
    Attached Files Attached Files
    Last edited by Allerdrengen; 11-17-2018 at 06:23 AM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,072

    Re: INDEX and AGGREGATE to ignore 0's and functions

    Your sample sheet wasn't hugely helpful. It was easy to add a few zeros... but I wasn't sure what you meant by "ignore functions"

    =IFERROR(INDEX(A$9:J$9,AGGREGATE(15,6,COLUMN(A:J)/(A2:J2>0),1))&IF(COUNTIF(A2:J2,">0")>=2,", "&INDEX(A$9:J$9,AGGREGATE(15,6,COLUMN(A:J)/(A2:J2>0),2)),"")&IF(COUNTIF(A2:J2,">0")>=3,", "&INDEX(A$9:J$9,AGGREGATE(15,6,COLUMN(A:J)/(A2:J2>0),3)),"")&IF(COUNTIF(A2:J2,">0")>=4,", "&INDEX(A$9:J$9,AGGREGATE(15,6,COLUMN(A:J)/(A2:J2>0),4)),""),"")
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: Lá fhéile Pádraig sona dhaoibh

  3. #3
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: INDEX and AGGREGATE to ignore 0's and functions

    Sorry, what I basically mean is that it should ignore everything that is not either a positive number or a negative number.
    In your suggestion, it also ignores negative numbers. Any ideas?

    And thanks!

  4. #4
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: INDEX and AGGREGATE to ignore 0's and functions

    So that would automatically leave out any cells with a "function" in them, which gives no return.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,072

    Re: INDEX and AGGREGATE to ignore 0's and functions

    I'm out walking. Try it and see what happens.

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: INDEX and AGGREGATE to ignore 0's and functions

    Try this.
    In M2 then dragdown
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  7. #7
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: INDEX and AGGREGATE to ignore 0's and functions

    Thanks for your response!
    It almost does the job, however, if a formula returns a blank cell, I would still like it to ignore the cell.
    Say I have a formula eg: "=IF(G10=20;40;"")" which would obviously return a blank cell. I need it treat the cell as though it was blank, even though there is a formula in the cell.

    Thanks!

  8. #8
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: INDEX and AGGREGATE to ignore 0's and functions

    Revised formula.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,072

    Re: INDEX and AGGREGATE to ignore 0's and functions

    or if you want a neater solution and don't mind a UDF:

    Please Login or Register  to view this content.
    How to install your new code
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Press Alt+F11 to open the Visual Basic Editor
    Choose Insert > Module
    Edit > Paste the macro into the module that appeared
    Close the VBEditor
    Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    The use this array formula:

    =ConcatAll(IF(Table1[@[Taxes]:[Balance]]<>0,IF(Table1[@[Taxes]:[Balance]]<>"",$A$9:$J$9,""),""),", ")

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: INDEX and AGGREGATE to ignore 0's and functions

    Thanks to the both of you! For now I'll be using the revised formula, but will definitely take a look at the UDF. Thanks!

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,072

    Re: INDEX and AGGREGATE to ignore 0's and functions

    You're welcome.

  12. #12
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: INDEX and AGGREGATE to ignore 0's and functions

    A question to the UDF though. I just figured that my actual datasheet is not a "table". So is it possible to do the UDF, without referencing to a table, but just a range of cells?
    Thanks!

  13. #13
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: INDEX and AGGREGATE to ignore 0's and functions

    Code for UDF inColumn M
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 11-18-2018 at 01:21 PM.

+ 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. Index/Aggregate Function for Lookup
    By VirenS in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-15-2017, 12:09 PM
  2. [SOLVED] Ignore specific colums from Aggregate function
    By BenHatton in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-28-2016, 04:21 AM
  3. Index Aggregate Troubleshoot
    By VirenS in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-16-2016, 07:32 AM
  4. Index, Aggregate, Row - Removing Duplicate W/ Index Help
    By adbexcel in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-04-2016, 03:53 PM
  5. INDIRECT, INDEX, AGGREGATE?? Help!
    By bbr in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-26-2013, 08:03 PM
  6. Functions-help for aggregate tab
    By kmsoni in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-22-2011, 03:10 AM
  7. aggregate functions: problem with SELECT SUM()
    By xianwinwin in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-14-2007, 01:51 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