+ Reply to Thread
Results 1 to 7 of 7

Ignore "if" formula for Lastrow function

  1. #1
    Forum Contributor
    Join Date
    10-08-2018
    Location
    Atlanta, Georgia
    MS-Off Ver
    Office 365
    Posts
    104

    Ignore "if" formula for Lastrow function


    Hi all,

    I am using the Lastrow function to define my range, but this is resulting in blank cells containing "if" formulae to be counted too. I want the last row to be the one where the "if" formula has resulted in a value ( in my case the column has dates in mm/dd/yy format) and ignore the rows below where the formula returns a blank ("") value.
    Any suggestions?

    Thanks

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Ignore "if" formula for Lastrow function

    One way to find the last non blank row is

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    10-30-2018
    Location
    London
    MS-Off Ver
    excel 2010
    Posts
    53

    Re: Ignore "if" formula for Lastrow function

    at first glance, maybe check the value of the variable with the isdate function.

  4. #4
    Forum Contributor
    Join Date
    10-08-2018
    Location
    Atlanta, Georgia
    MS-Off Ver
    Office 365
    Posts
    104

    Re: Ignore "if" formula for Lastrow function

    Essentially, need to alter this definition of LastRow to ignore rows where formula has resulted in "" values-
    LastRow = ActiveSheet.Range("AD" & Rows.Count).End(xlUp).Row

    Sorry, couldn't adopt the solutions suggested by Brian and Richard, due to my limited understanding of how VBA works.

  5. #5
    Registered User
    Join Date
    10-30-2018
    Location
    London
    MS-Off Ver
    excel 2010
    Posts
    53

    Re: Ignore "if" formula for Lastrow function

    hi there

    can you post the code youre working with by any chance?

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Ignore "if" formula for Lastrow function

    Maybe something like
    Please Login or Register  to view this content.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Ignore "if" formula for Lastrow function

    Quote Originally Posted by bsrivatsa View Post
    Essentially, need to alter this definition of LastRow to ignore rows where formula has resulted in "" values-
    LastRow = ActiveSheet.Range("AD" & Rows.Count).End(xlUp).Row

    Sorry, couldn't adopt the solutions suggested by Brian and Richard, due to my limited understanding of how VBA works.
    My suggested function does not involve VBA

    See the attached example. A2:A20 contain dates which only show if the adjacent column B contains a 1.

    If you need to use it in VBA then just read it in from the Excel cell that holds the value.
    Attached Files Attached Files
    Last edited by Richard Buttrey; 12-13-2018 at 03:48 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. [SOLVED] Need help modifying multiple range code to include LastRow ("B2:B10",..) -> ("B2:B" & LR.)
    By sureng20 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2017, 09:31 AM
  2. [SOLVED] If function to ignore '+' & "-" symbols
    By liamfrancis2013 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-16-2017, 08:30 AM
  3. Trying to improve speed of Index match, want to lookup "A1:A" & lastrow
    By OTWarrior in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-11-2017, 12:38 PM
  4. [SOLVED] Adding "Lastrow" function to these formulas:
    By Chad Bateman in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-25-2015, 10:59 PM
  5. Using the "DAYS360" function-ignore blank cell
    By wvpersephone13 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-17-2014, 12:54 AM
  6. [SOLVED] Counting data only contains text (ignore mark "-" & "")
    By Jhon Mustofa in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-12-2014, 09:45 PM
  7. [SOLVED] Replace "insert function" with "edit formula" button in fourmula b
    By 13brian in forum Excel General
    Replies: 0
    Last Post: 08-24-2005, 04:05 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