+ Reply to Thread
Results 1 to 5 of 5

function returning blank on running

  1. #1
    Registered User
    Join Date
    11-29-2020
    Location
    india
    MS-Off Ver
    2021
    Posts
    92

    function returning blank on running

    i m trying to pass a value from cell and check if its between the values of 2 columns and accordingly pull a 3rd cell value, but it always returns blank , the value passed in is format 10:20:30 where 10 is degree 20 is min and 30 is seconds and apple so the sheet where is has data is like

    Please Login or Register  to view this content.
    so the output should be "green" but its blank

    Please Login or Register  to view this content.
    Last edited by littleangel; 01-23-2021 at 02:32 AM.

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: function returning blank on running

    FindMD is set at the end, equal to Result. Result is set in one and only one place, inside an If . . . If construct, and it's set equal to a value in degrees!B2:B250.

    Are you sure any cell in degrees!A2:A250 equals chkname? For the heck of it, add the following immediately before your 2nd For statement.

    Please Login or Register  to view this content.
    If this statement suspends execution, then no cell in degrees!A2:A250 matches chkname. In which case a likely cause would be trailing spaces in degrees!A2:A250.

    Are you certain there are values in degrees!B2:B250? If so, are you certain there's some instance in which chkseconds2 <= chkseconds1 And chkseconds1 < chkseconds3?

    For the heck of it, right before the If . . . If construct in which you set Result, add this statement.

    Please Login or Register  to view this content.
    If nothing appears in the Immediate window, then there are no instances of chkseconds1 falling between chkseconds2 and chkseconds3. On the other hand, if there are lines produced in the Immediate windows, does the LAST ONE show something between the square brackets? Note that the logic you're using iterates through the entire range degrees!A2:A250, and it only returns the value from degrees!B2:B250 corresponding to the LAST ROW in which chkseconds1 falls between chkseconds2 and chkseconds3. If all rows from 2 to 249 contain something in column B, but B250 is blank and A250 produces chkseconds2 and chkseconds3 which bracket chkseconds1, "" would be the expected (though apparently not intended) return value.

  3. #3
    Registered User
    Join Date
    11-29-2020
    Location
    india
    MS-Off Ver
    2021
    Posts
    92

    Re: function returning blank on running

    I updated the post with the data...values do exist but it still fails the
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: function returning blank on running

    Just saw the problem: you're not resetting check2 or check3 to 0 after the 3rd and 4th For loops. Thus, after processing degrees!C2 and degrees!D2, count2 and count3 are both 3, so when you process degrees!C3 and degrees!D3, count2 and count3 would be 4, 5 and 6 in the 3 If blocks, for the next row 7, 8 and 9, etc.

    Perhaps eliminate the 1st, 3rd and 4th For loops and use

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-29-2020
    Location
    india
    MS-Off Ver
    2021
    Posts
    92

    Re: function returning blank on running

    ok i changed it and it worked...thank u so much
    Last edited by littleangel; 01-23-2021 at 03:21 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. Stop INDIRECT function returning a 0 if cell is blank?
    By Belinea2010 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-03-2021, 10:39 AM
  2. function returning blank on running
    By littleangel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2020, 09:47 AM
  3. [SOLVED] running a function with multiple variables left blank
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2016, 04:03 PM
  4. [SOLVED] If function returning incorrect value reference cell value is blank
    By lbrannon in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 10-23-2013, 09:40 AM
  5. [SOLVED] Excel function is returning undesired answer for blank cells
    By dcwandj in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-28-2012, 12:14 PM
  6. Replies: 5
    Last Post: 12-02-2009, 08:02 AM
  7. returning blank cells in an IF function
    By Squeky in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-25-2006, 10:00 PM

Tags for this Thread

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