+ Reply to Thread
Results 1 to 9 of 9

Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

  1. #1
    Registered User
    Join Date
    08-22-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel for mac 2010
    Posts
    8

    Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

    Hi,

    I have the following formula in 20 cells in Column A which references values in column V in a sheet called December 2014:

    =INDEX('DECEMBER 2014'!$V$2:$V$20,MATCH(0,INDEX(COUNTIF($A$1:A1,'DECEMBER 2014'!$V$2:$V$20),0,0),0))

    It gives the following results:

    United Kingdom
    United States
    New Zealand
    0
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A
    #N/A

    In order to conditionally format non blank cells containing country names I wish to convert the #N/A and 0 to blank cells by incorporating it into the formula. I realise I can change the format of the cells to 0;-0;;@ but I'd much rather do it in a formula.

    I have also successfully managed to use IF(ISERROR......) in another formula but not in combination with the zeros.

    Any help greatly appreciated as it's been driving me nuts!

    Cheers

    Mark

  2. #2
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

    Would something like this work?

    Please Login or Register  to view this content.
    I'm sure someone else could think of a more concise formula, but this would be a quick and dirty approach.

    Hope this helps!
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

    Try

    =IFERROR(T(INDEX('DECEMBER 2014'!$V$2:$V$20,MATCH(0,INDEX(COUNTIF($A$1:A1,'DECEMBER 2014'!$V$2:$V$20),0,0),0))),"")

  4. #4
    Registered User
    Join Date
    08-22-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel for mac 2010
    Posts
    8

    Re: Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

    That is great, thanks guys. Both options worked so have chosen the latter.

    There might be a couple of others but i'll try and fathom it out before asking!

    Cheers!

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

    You're welcome.

    Note on my formula, the T function is what's hiding the 0, but it will only work here if the 'Expected' Result of the Index/Match is a TEXT value.
    If the result of the Index Match is any number other than 0, it will be hidden as well.
    But your example appears to be returning just Text Strings.

  6. #6
    Registered User
    Join Date
    08-22-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel for mac 2010
    Posts
    8

    Re: Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

    Yeah, I've just tried the following with results as you describe - it doesn't work as the expected value is a number:

    =IFERROR(T(COUNTIF('DECEMBER 2014'!$V$2:$V$7,A2)),"")

    Is there, by any chance, a numerical equivalent to the 'T' function?

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

    For that you'd have to go with mcmahobt's method.

    But I'd use IFERROR instead of IF(ISERROR

    =IFERRROR(IF(COUNTIF(....)=0,"",COUNTIF(...)),"")

  8. #8
    Registered User
    Join Date
    08-22-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel for mac 2010
    Posts
    8

    Re: Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

    I've just managed to sort it by using:

    =IF(COUNTIF('DECEMBER 2014'!$B$2:$B$7,C2)=0,"",COUNTIF('DECEMBER 2014'!$B$2:$B$7,C2))

    I didn't need the IFERROR as the result would never be in error - just 0 upwards.

    It looks really simple and logical now it is working!

    Huge thanks for the help and pointers, much appreciated.

    Mark

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Converting errors and zeros to blanks in nested INDEX,MATCH & COUNTIF formula

    You're welcome.

+ 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. How to ignore blanks in an Index/Match Array Formula
    By michaelcarrera in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-06-2015, 08:50 PM
  2. Replies: 2
    Last Post: 03-25-2014, 05:37 PM
  3. Nested index formula - need to ignore errors
    By Fursmanm in forum Excel General
    Replies: 0
    Last Post: 09-20-2012, 09:50 AM
  4. hide zeros and NA#'s from result of Index/match formula
    By merlyn45 in forum Excel General
    Replies: 2
    Last Post: 05-10-2012, 02:10 PM
  5. Nested Match(index()) vs. Match() array formula.
    By GeneralDisarray in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-14-2011, 07:57 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