+ Reply to Thread
Results 1 to 11 of 11

Find Criteria in a Range and Return a Cell

  1. #1
    Registered User
    Join Date
    02-24-2015
    Location
    Houston, TX
    MS-Off Ver
    2013 and 2010
    Posts
    26

    Find Criteria in a Range and Return a Cell

    I have attached what I am trying to do with an example.

    Basically, I need to know when the first day A, B, C... does not have a zero (could be negative or positive).

    I cannot think of a formula or function that could do this for me but I know it has to be possible.

    Thanks all!
    Attached Files Attached Files
    Last edited by gtbaseball7; 04-13-2015 at 04:46 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Find Criteria in a Range and Return a Cell

    Try this, copied down...
    =IF(COUNTIF(F6:V6,"<>0")>0,SUMPRODUCT(($F$5:$V$5),--(F6:V6<>0)),"")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    02-24-2015
    Location
    Houston, TX
    MS-Off Ver
    2013 and 2010
    Posts
    26

    Re: Find Criteria in a Range and Return a Cell

    You are good, FDibbins. You are good.

    What does the "--" mean?

    You are much appreciated.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Find Criteria in a Range and Return a Cell

    F6:V6<>0 returns a series of TRUE FALSE answers. -- coerces those into 1 or 0

  5. #5
    Registered User
    Join Date
    02-24-2015
    Location
    Houston, TX
    MS-Off Ver
    2013 and 2010
    Posts
    26

    Re: Find Criteria in a Range and Return a Cell

    FDibbins,

    When I applied this formula to the actual data, I ran into a problem =. I want to return the FIRST day it is not zero. The current formula will only work if it's all zeroes except for one day.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Find Criteria in a Range and Return a Cell

    You can use this formula in D6

    =IFERROR(SMALL(IF(F6:V6<>0,F$5:V$5),1),"")

    confirmed with CTRL+SHIFT+ENTER and copy down

    I'm assuming that by "first date" you mean the earliest one (not the first one positionally, although if they are sorted that will be the same thing)
    Audere est facere

  7. #7
    Registered User
    Join Date
    02-24-2015
    Location
    Houston, TX
    MS-Off Ver
    2013 and 2010
    Posts
    26

    Re: Find Criteria in a Range and Return a Cell

    the first argument in the if statement (the logical test argument) is an array and returns a #value! error (i took out the iferror to see which error it was)

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Find Criteria in a Range and Return a Cell

    Try this 1 then from Tom Urtis...
    =IFERROR(INDEX($F$5:$V$5,MATCH(TRUE,INDEX((F6:V6<>0),0),0)),"")

  9. #9
    Registered User
    Join Date
    02-24-2015
    Location
    Houston, TX
    MS-Off Ver
    2013 and 2010
    Posts
    26

    Re: Find Criteria in a Range and Return a Cell

    This one is it! I have never seen the "TRUE" argument used as the reference. Seems to be working great!

    Thank you Dibbins! (and Tom Urtis)

    And thank you all that tried to help!

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Find Criteria in a Range and Return a Cell

    Quote Originally Posted by gtbaseball7 View Post
    the first argument in the if statement (the logical test argument) is an array and returns a #value! error (i took out the iferror to see which error it was)
    The formula I suggested is an "array formula". You need to confirm with CTRL+SHIFT+ENTER. To do that correctly you put the formula in a cell, press F2 to select the formula and then hold down CTRL and SHIFT keys while pressing ENTER

    If you do that correctly you should get correct results. If you don't do that you may see #VALUE! error

    Another way, that avoids "array entry" is like this:

    =IFERROR(AGGREGATE(15,6,F$5:V$5/(F6:V6<>0),1),"")

    See attached for my two suggestions and Ford's - all three return the same results in your sample
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-24-2015
    Location
    Houston, TX
    MS-Off Ver
    2013 and 2010
    Posts
    26

    Re: Find Criteria in a Range and Return a Cell

    DaddyLL,

    You are correct. I need to keep studying these excel nuances. I am not familiar with your technique but it does work.

    Thank you!

+ 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. Find a string withing cell range and return cell number
    By visak in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-16-2015, 09:19 PM
  2. [SOLVED] Find a value in a range then return the cell address
    By corinereyes in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-16-2014, 06:48 AM
  3. [SOLVED] find value meeting certain criteria in a range and return that value
    By bardobhb in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-21-2014, 02:03 PM
  4. [SOLVED] Return a text value in a cell if criteria is meet within a range
    By fireguy7 in forum Excel General
    Replies: 2
    Last Post: 01-16-2013, 11:49 AM
  5. [SOLVED] Formula to return ADDRESS of cell in range that meets criteria
    By Christie in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-04-2005, 08:06 PM

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