+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : subtracting consecutive non-sero numbers down a column

  1. #1
    Registered User
    Join Date
    02-27-2012
    Location
    galway, ireland
    MS-Off Ver
    Excel 2007
    Posts
    3

    Question subtracting consecutive non-sero numbers down a column

    i have a column that shows the peaks of a varying frequency sine wave. It displays the peak x values (using an if statement) but in between the peaks it shows 0 as a results of the false=0 of my if statement. now i would like to get the distance between adjacent peaks by subtracting them but how do i omit the 0's

    I cannot simply choose the cell that is non zero as this particular sine graph is dependant on a parameter that i am changing constantly so a particular cell does not always contain this non-zero term.

    thanks in advance

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: subtracting consecutive non-sero numbers down a column

    How do you handle it when you get to a 0?

    If the values are in say A1 down, then in B2 enter:

    =IF(A2=0,0,A2-LOOKUP(2,1/(A$1:A1<>0),A$1:A1))

    this will put a 0 if the cell is 0, but will subtract last non-zero value when you are not at a 0 in the list.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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