+ Reply to Thread
Results 1 to 9 of 9

Excel 2007 populating a cell based on values in other cells

Hybrid View

  1. #1
    Registered User
    Join Date
    07-09-2012
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Excel 2007 populating a cell based on values in other cells

    I am working on an expense report and each type of the expense has a different code. I would like to have the Code cell populate with a value based on which cell they enter the amount in. For example, if a value was entered in cell B1 for Hotel, then the value in the Code cell A1 would be "001". If a value was entered in cell C1 for "Mileage", then the value in cell A1 would be "002". There will only be one value in either B1 or C1.

    Is it possible for A1 to change based on the value in more than one cell? I have tried the embedded "IF" statements but cannot seem to make it work.

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Excel 2007 populating a cell based on values in other cells

    Hi,

    How are you determining the code? Are you using a vlookup or is it hard coded in the formula?

    Steve

  3. #3
    Registered User
    Join Date
    07-09-2012
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Excel 2007 populating a cell based on values in other cells

    Hi Steve,

    It is hardcoded in the formula. There are seven of them:

    B1 = 001
    C1 = 002
    D1 = 003
    E1 = 004
    F1 = 005
    G1 = 006
    H1 = 007

    The values in B1 through H1 can change but the value in A1 is hard coded based on the fact that there is a value in the cell B1 through H1. The IF statement that covers one cell is "=IF(B1836,"001","")". I need this type of formula to work for multiple cells.

    Thanks!

  4. #4
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Excel 2007 populating a cell based on values in other cells

    Hi,

    Can you post a worksheet with dummy data showing the before and after?

    Thanks,
    Steve

  5. #5
    Registered User
    Join Date
    07-09-2012
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Excel 2007 populating a cell based on values in other cells

    Please see the attached dummy data spreadsheet with the before and after. Note that when data is entered into the "Hotel (001)" column, the value in the "Code" column is 001.
    Attached Files Attached Files
    Last edited by pbsj; 07-12-2012 at 09:13 AM.

  6. #6
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Excel 2007 populating a cell based on values in other cells

    In cell A1, does =B1&C1&D1&E1&F1&G1&H1 work?

    Pauley

  7. #7
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Excel 2007 populating a cell based on values in other cells

    In cell B1:
    =OFFSET($A$1,MATCH(SUM(B2:B5),B2:B5),0)

    Then copy across to E1.

    Pauley

  8. #8
    Registered User
    Join Date
    07-09-2012
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Excel 2007 populating a cell based on values in other cells

    Unfortunately, this is not what I need. I need the Code column to be populated only if there is a value in that row. If you do not have a value in cell C3, 002 will not appear in cell A3. Similarly, if there is no value in cell E4, there will not be a value 003 in A4. Rows 3 and 4 would not have anything in the Code column (column A), since there is nothing entered in the other columns on that row. If you entered a value in E3, A3 would be 004 but if a value was entered in D3 instead, A3 would be 003.

    Thanks for your help!

  9. #9
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Excel 2007 populating a cell based on values in other cells

    Put this in cell B1 and then copy down.

    ="00"&MATCH(SUM(B2:E2),B2:E2)

    Pauley

+ 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