+ Reply to Thread
Results 1 to 5 of 5

DifferenceIF

  1. #1
    Forum Contributor
    Join Date
    05-09-2017
    Location
    NC
    MS-Off Ver
    2013
    Posts
    103

    DifferenceIF

    I am calculating the last 20 data points in column H. Column H currently has a formula in it which is (=G1-F1) and this runs down the entire column of H for it's corresponding cell. My problem is another section averages the last 20 data points which works fine however column H is now full all the way down with zeros if the corresponding columns of F and G are blank. This would be simple with a SumIf function but I am needing the difference and excel does not have a differenceIf.

    Currently unable to put up a spreadsheet example but pretty straight forward.

    Thank you for any help

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: DifferenceIF

    Maybe, in H:

    =IF(OR(G1="",F1=""),"",G1-F1)

  3. #3
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: DifferenceIF

    Maybe PivotTable will do that?

    without example excel file this is just guesses

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: DifferenceIF

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Forum Contributor
    Join Date
    05-09-2017
    Location
    NC
    MS-Off Ver
    2013
    Posts
    103

    Re: DifferenceIF

    My apologies for not being to add an example at the time but PaulM100 crushed it for me so thank you Paul. I compared my existing 3K data points old formula to his modified version and got the same results plus it allowed my average formula to be correct.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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