+ Reply to Thread
Results 1 to 7 of 7

Subtract entry from one column left from last entry, only if both non-blank.

  1. #1
    Registered User
    Join Date
    02-06-2017
    Location
    Whangarei, New Zealand
    MS-Off Ver
    2016
    Posts
    4

    Subtract entry from one column left from last entry, only if both non-blank.

    Hello,
    I am using =LOOKUP(2,1/(V2:AI2<>""),V2:AI2) to return the last (ie furthest to the right) non blank entry from Row V2:AI2. This works well.
    But...
    I would like to subtract the entry that is one column to the left from this last entry, only if it is non-blank, and then fill down.
    If necessary I would make a new column with the one column to the left entries (a formula for this anybody?), and then a new column to subtract, but being an Excel efficiency pedant, I wonder if there is one formula that will do the whole lot, and then just fill down.

    eg First row: 2, 4, blank, 3, 3.5, blank, blank, blank would return 0.5 (i.e. 3.5 - 3)
    after fill down...
    fifteenth row: 0, blank, 1, 2, 1, 2, 4, blank would return 2 (i.e. 4-2)
    twentieth row: 1, 2, 2, 2, 3, 3.5, blank, 4 would return blank or error or similar (i.e. can't subtract blank from 4)


    Regards, Bucksy
    Last edited by Bucksy; 02-06-2017 at 07:35 PM.

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Subtract entry from one column left from last entry, only if both non-blank.

    Try this ...

    =IF(LOOKUP(2,1/(V2:AI2<>""),U2:AH2)="","",LOOKUP(2,1/(V2:AI2<>""),V2:AI2-U2:AH2))

  3. #3
    Registered User
    Join Date
    02-06-2017
    Location
    Whangarei, New Zealand
    MS-Off Ver
    2016
    Posts
    4

    Re: Subtract entry from one column left from last entry, only if both non-blank.

    Wonderful! Works a treat. Thank you.
    So how do I subtract the number 2 columns left? I have tried shifting the ranges without luck.


    Regards, Richard

  4. #4
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Subtract entry from one column left from last entry, only if both non-blank.

    Quote Originally Posted by Bucksy View Post
    So how do I subtract the number 2 columns left?
    V2:AI2-U2:AH2

    Range offset -1

  5. #5
    Registered User
    Join Date
    02-06-2017
    Location
    Whangarei, New Zealand
    MS-Off Ver
    2016
    Posts
    4

    Re: Subtract entry from one column left from last entry, only if both non-blank.

    Cảm ơn bạn

    I think I have it. Thank you again.

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Subtract entry from one column left from last entry, only if both non-blank.

    You're welcome!

  7. #7
    Registered User
    Join Date
    02-06-2017
    Location
    Whangarei, New Zealand
    MS-Off Ver
    2016
    Posts
    4

    Re: Subtract entry from one column left from last entry, only if both non-blank.

    When I offset I started including a column with dates, so I had to insert a couple of blank columns. It also appears that the ranges need to be the same number of columns.

+ 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. If mySQL database column entry matches excel column entry, then...
    By khelza in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2015, 02:34 PM
  2. subtract values of column E, user entry
    By myjebay1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-08-2012, 02:58 PM
  3. Replies: 0
    Last Post: 10-06-2011, 07:03 AM
  4. column Number of Last Non-blank entry in a row
    By axecel in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-13-2010, 08:28 AM
  5. Replies: 2
    Last Post: 09-18-2008, 05:47 AM
  6. last non-blank column entry
    By CraigSA in forum Excel General
    Replies: 1
    Last Post: 04-05-2006, 05:30 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