+ Reply to Thread
Results 1 to 11 of 11

Formula on the same column

Hybrid View

  1. #1
    Registered User
    Join Date
    06-22-2012
    Location
    Davey
    MS-Off Ver
    Excel 2011 mac
    Posts
    7

    Formula on the same column

    I have an excel sheet where we write down the costs of food shopping and want to see the difference between the last two months, even after adding a new month

    A = person that shops
    B = amount for January
    C = amount for February
    D = Difference

    In the D column I will add the formula =sum(B2-C2) This will give me the difference between those months. But what if I want to add a new month (March) What would be the best way to see the difference between those months without changing the formula?

    I tried to do it the other way
    A = person that shops
    B = difference
    C = amount for February
    D = Amount for January

    with the formula in B =sum($B$2-$C$2) which works but when I add a new column between B and C for the month March... the formula will automatically change to =sum($C$2-$D$2).

    I hope I made myself a bit clear ... How can I keep the formula the same?

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

    Re: Formula on the same column

    Try:

    =sum(B2-INDEX(2:2,3) )

    This always subtract C2 from B2... unless you insert before B2, then it becomes C2.. and you will need to adjust the 3 to column number...
    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.

  3. #3
    Registered User
    Join Date
    06-22-2012
    Location
    Davey
    MS-Off Ver
    Excel 2011 mac
    Posts
    7

    Re: Formula on the same column

    Thanks for the fast reply... but I can't... what am I doing wrong
    Screen Shot 2012-06-23 at 1.29.58 AM.png

    sorry I'm not very good at using Excel yet

  4. #4
    Registered User
    Join Date
    06-22-2012
    Location
    Davey
    MS-Off Ver
    Excel 2011 mac
    Posts
    7

    Re: Formula on the same column

    I'm looking around on the web the whole time... Am I the only one who is trying to do this?

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

    Re: Formula on the same column

    The formula assumed you had set up based on the first post you posted.... so formula would be in column D.

    If you want to go with formula in column B...then.

    =C2-INDEX(2:2,4)

    The SUM() is actually redundant for this...

  6. #6
    Registered User
    Join Date
    06-22-2012
    Location
    Davey
    MS-Off Ver
    Excel 2011 mac
    Posts
    7

    Re: Formula on the same column

    It works.. but the problem is I want to insert a new column between B and C.. and when I do that. the formula will change from C2 to D2..

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

    Re: Formula on the same column

    So are talking about the setup in your attachment or in the first post?

    After you insert a column what exactly do you want to calculate? Is it always the newly inserted column minus the March column (currently column D in the attachment)?

  8. #8
    Registered User
    Join Date
    06-22-2012
    Location
    Davey
    MS-Off Ver
    Excel 2011 mac
    Posts
    7

    Re: Formula on the same column

    I just added the Excel file..

    Bit different but same meaning.


    I count the difference(G) between 5/30/16(F) and 4/27/16(E) that.

    I want to add a new column between Column F and G and add 6/28/12 in it. The difference column had to calculate the difference between June and May... Then the month after that I want to add another column and add July in it so that I can count the difference between July and June...

    Basically I want to count the diference between the current and the month before that without having to change the formula over and over again.

    Once again thank you for your help, I really appreciate it and I apologize for maybe not being clear enough.
    Attached Files Attached Files

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula on the same column

    Simplest way would be to insert a new column immediately left of the results column. The results would use INDEX() functions that included that 'extra' column. Then, when inserting new monthly columns, you insert to the left of that extra column.
    Use this formula in H2 (after inserting that new 'extra' column):

    =INDEX(D2:G2,COUNT(D2:G2))-INDEX(D2:G2,COUNT(D2:G2)-1) and drag down

  10. #10
    Registered User
    Join Date
    06-22-2012
    Location
    Davey
    MS-Off Ver
    Excel 2011 mac
    Posts
    7

    Re: Formula on the same column

    Hi Cutter!

    That's awesome, thanks a lot for that.

    @NBVC
    Thanks for the help and my apologizes for being unclear.

  11. #11
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formula on the same column

    You're welcome. Please remember to mark your thread as SOLVED (instructions in rule #9 - click Forum Rules @ top of page to view).

+ 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