+ Reply to Thread
Results 1 to 3 of 3

How can I compare an item to an array of cells but skip blanks?

  1. #1
    Forum Contributor
    Join Date
    06-12-2020
    Location
    USA
    MS-Off Ver
    2013
    Posts
    132

    How can I compare an item to an array of cells but skip blanks?

    I am trying to use this formula to compare cell A3 to the values in cells A4 to A20 but I don't want to compare it to any blank cells. This is the formula I tried but it fails with a #VALUE error. =SUMPRODUCT(($A3>($A$4:$A$20*NOT(ISBLANK($A$4:$A$20)))))>0 I'm sure it fails because it's trying to multiply text by a number. However, stepping through the formula I noticed the blank cells are being treated as a value '0' and A3 is always going to be 'greater' than '0'. The goal is to see if A3 is out of order. TIA
    Attached Files Attached Files
    Last edited by bird333; 06-17-2021 at 01:42 PM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,458

    Re: How can I compare an item to an array of cells but skip blanks?

    In order to compare, using SUBSTITUTE to replace "-" then range to become value, then SUM

    =SUMPRODUCT(--(SUBSTITUTE($A$4:$A$20,"-","") < SUBSTITUTE($A3,"-","")))
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    06-12-2020
    Location
    USA
    MS-Off Ver
    2013
    Posts
    132

    Re: How can I compare an item to an array of cells but skip blanks?

    Quote Originally Posted by bebo021999 View Post
    In order to compare, using SUBSTITUTE to replace "-" then range to become value, then SUM

    =SUMPRODUCT(--(SUBSTITUTE($A$4:$A$20,"-","") < SUBSTITUTE($A3,"-","")))
    Thanks for the response, but this isn't what I'm looking for. There should only be 8 numbers that are less than A3 but the answer I am getting with your formula is 13. That is because the blanks are still being counted. There are 5 blanks in that range. 8+5=13. I need to eliminate the blank lines which is what I was trying to do with this part of my formula "NOT(ISBLANK($A$4:$A$20))" (actually counting non-blank cells). If there was a way to multiply the two that would eliminate the cells I don't want.


    EDIT: I thought I had a solution but for some crazy reason the formula is evaluating A3 (90100000012) as being larger than A17:A20 which it is not. =SUMPRODUCT(--(SUBSTITUTE($A3,"-","")>(SUBSTITUTE($A$17:$A$20,"-","")*NOT(ISBLANK($A$17:$A$20)))))>0 (narrowed the range done just to those items that should be greater than A3 for testing purposes).

    EDIT 2: I made this way too complicated. Just needed to do this. =SUMPRODUCT(($A3>($A$4:$A$20))-ISBLANK($A$4:$A$20))>0
    Last edited by bird333; 06-17-2021 at 05:48 AM.

+ 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. List Array Formula with Criteria skip blanks
    By hjforever83 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-24-2020, 01:05 PM
  2. [SOLVED] Skip Blanks when copying a range of cells with VBA
    By aglawrence in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-13-2018, 03:32 PM
  3. VBA: Multiply Cells by Value but Skip Blanks
    By jblack6572 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-25-2017, 04:50 PM
  4. [SOLVED] Comparing cells with a reference source & skip blanks
    By namialus in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-04-2014, 10:57 PM
  5. how to skip cells that appears as blanks ?
    By igneous2000 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-30-2014, 04:05 AM
  6. Replies: 4
    Last Post: 03-08-2014, 02:03 PM
  7. skip NON blank cells and fill only blanks
    By donyc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-01-2012, 11:33 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