+ Reply to Thread
Results 1 to 9 of 9

Set cell to take value from most recently filled in column

  1. #1
    Registered User
    Join Date
    11-30-2009
    Location
    Arlington, VA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Question Set cell to take value from most recently filled in column

    I was trying to search for if this was possible, but I wasn't exactly sure what it would be called, so I thought that I'd post here.

    I have a table with 10 rows (different programs) and 12 columns (different months). The table is for keeping track of an amount spent.

    I would like to be able to create another column that finds the percentage for the amount spent/total originally available.

    However, I don't want to create a whole table to calculate the values. I only want one column of percentage values.
    I would like a formula to automatically calculate the percentage of each row, only for the most recent month.

    For example, now I want it to calculate the November percentages, and next month when I input the December data, I want it to change to calculate the December percentages, without me having to redo the formulas.

    How can this be done? I think it should be possible, but it is way beyond my excel knowledge.

    Thaank youu!

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Set cell to take value from most recently filled in column

    Hi,

    You can do this using the OFFSET function.

    For example, where there is a list of data in column A starting in A1, use this

    =OFFSET(A1,COUNTA(A:A)-1,0)

    to return the last cell in the column.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    11-30-2009
    Location
    Arlington, VA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Question Re: Set cell to take value from most recently filled in column

    I'm trying to figure out the offset function, and maybe I'm not understanding it correctly, but it seems that it just copies a cell and puts it in a different place?

    I will give a more detailed example of what I am trying to do (the formatting is bad, but think of it as an excel looking file):
    The info I have in my excel:

    Totals for the year:
    Program 1: 100
    Program 2: 150
    Program 3: 125

    Amount Spent (What input would look like at the end of November)
    October November December January
    Program 1: 10 15
    Program 2: 15 30
    Program 3: 10 20

    Amount Spent (What input would look like at the end of January)
    October November December January
    Program 1: 10 15 20 30
    Program 2: 15 30 45 50
    Program 3: 10 20 25 35

    What I am want to figure out how to do:
    (amount spent/total)
    After November is input I want to see:
    Program 1: 10% (10/100)
    Program 2: 10% (15/150)
    Program 3: 8% (10/125 )

    After January is input I want to see:
    Program 1: 30% (30/100)
    Program 2: 33.3% (50/150)
    Program 3: 28% (35/125 )

    I know how to have it automatically calculate based on a cell, but I would like to be able to change the cell it is calculated from without having to manually input it.
    EX. have it go from calculating C3/B10, C4/B11, C5/B12 to calculating E3/B10, E4/B11, E5/B12

    I am thinking that it would know which column to use based on what is filled in. It would take the column furthest to the right that is filled in.

    Is offset the right formula tool to do this?
    Last edited by dunCar; 11-30-2009 at 05:06 PM.

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Set cell to take value from most recently filled in column

    See if the attached is what you intended.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  5. #5
    Valued Forum Contributor khamilton's Avatar
    Join Date
    10-08-2009
    Location
    IL
    MS-Off Ver
    Excel 2007
    Posts
    345

    Re: Set cell to take value from most recently filled in column

    Maybe????
    dunCar.xls

  6. #6
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Set cell to take value from most recently filled in column

    The OFFSET function returns the contents of a cell offset by a number of rows and columns. By combining the offset function with the COUNT or COUNTA function it is possible to obtain the value in the final cell in a row or column, as per the example above.

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Set cell to take value from most recently filled in column

    I would suggest using LOOKUP given it is neither Volatile nor susceptible to blank data points, ie

    =LOOKUP(9.99999999999999E+307,$E2:$P2)

    would give you the last numeric value entered in range E2:P2

    In short were it me I would adopt khamilton's earlier example.

  8. #8
    Registered User
    Join Date
    11-30-2009
    Location
    Arlington, VA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Thumbs up Re: Set cell to take value from most recently filled in column

    Hurray! It worked!

    Ok, I've finally had time to look through these responses, and I definitely learned a TON about excel from everyone who responded. I feel like an expert now. lol

    I decided to use the Lookup suggestion, as I understood it more easily, and I think that I can fix it more easily if I mess up...lol... but it seems that they both would have worked.

    Here is the final equation that made it work for me:
    =IF(LOOKUP(9.99999999999999E+307,D74:O74)=0,0%,LOOKUP(9.99999999999999E+307,D74:O74)/(LOOKUP(9.99999999999999E+307,D31:O31)))

    If the latest cell is a 0, put 0%. If not, look up the latest amount spent and divide by the latest amount authorized.

    YAY!

    Thank you all!

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Set cell to take value from most recently filled in column

    Shouldn't the first lookup be referencing D31:O31 rather than D74:O74... given the latter is the divisor
    (ie if row 31 returned 0 the subsequent division would generate #DIV/0! whereas if row 31 was not 0 and row 74 was zero the output would simply be 0% anyway)

+ 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