+ Reply to Thread
Results 1 to 4 of 4

Formula Query: How to calculate the difference between two columns of data?

  1. #1
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Formula Query: How to calculate the difference between two columns of data?

    Hi,

    I've got two columns of data, column A contains the value and column B contains either 'Dr' or 'Cr'. I want to put a total at the bottom that shows the difference between the two, what is the best way to go about this? My spidee senses tell me it's SUMPRODUCT time but all solutions are gratefully received.

    Thanks,

    Snook
    Last edited by The_Snook; 09-25-2012 at 01:23 PM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Formula Query: How to calculate the difference between two columns of data?

    hi Snook, your spidey sense is correct~ you can use SUMPRODUCT:
    =SUMPRODUCT((B1:B10="Dr")*(A1:A10))-SUMPRODUCT((B1:B10="Cr")*(A1:A10))

    or SUMIF:
    =SUMIF(B1:B10,"Dr",A1:A10)-SUMIF(B1:B10,"Cr",A1:A10)

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Formula Query: How to calculate the difference between two columns of data?

    Hi

    SUMIF, i think is the best way.

    =SUMIF(B1:B100,"Dr",A1:A100)-SUMIF(B1:B100,"Cr",A1:A100)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Re: Formula Query: How to calculate the difference between two columns of data?

    Thanks benishiryo and Fotis1991, rep points all round

+ 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