+ Reply to Thread
Results 1 to 6 of 6

If cell equals "Y" then insert the contents of another cell

  1. #1
    Registered User
    Join Date
    03-27-2013
    Location
    Lancashire
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    2

    If cell equals "Y" then insert the contents of another cell

    Hi,

    I have a simple table for mileage and the costs are either to be charged to one company or another.

    The table has the following 6 headers:

    Date->Total miles->Client 1->Client 1 formula->Client 2->Client 2 formula

    I insert the total miles for the trip in the total miles column and then insert a Y under either Client 1 or Client 2, depending on which client it is to be charged to.

    Ideally I want a formula for the "Client 1 formula" column that says if the Client 1 cell equals "Y" then insert the number of miles shown in the corresponding "Total miles" column

    I will then hide the column and do a summary stating number of miles for Client 1 and number of miles for Client 2.

    Thanks x

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,731

    Re: If cell equals "Y" then insert the contents of another cell

    =IF(client1cell ="Y", cell for totalmiles , "")

    assuming setup as

    Date->Total miles->Client 1->Client 1 formula-
    A2>B2>C2>D2

    in D2
    =IF(C2="Y", B2,"")

    you could use SUMIF
    =SUMIF(C2:C4,"Y",B2:B4) for client 1 and then

    =SUMIF(E2:E4,"Y",B2:B4) for client 2 assuming Y is in E column for that client

    saves the extra column and will do the total in one go

    you could go 1 step further and then in your column for which client put
    client1
    or
    client2

    and then use two sumif and use the criteria of client1 or client2 to add the totals
    =SUMIF(C2:C4,"client1",B2:B4)
    =SUMIF(C2:C4,"client2",B2:B4)
    Last edited by etaf; 03-27-2013 at 09:31 AM.

  3. #3
    Forum Contributor
    Join Date
    05-04-2009
    Location
    ME
    MS-Off Ver
    Excel 2003,2007
    Posts
    157

    Re: If cell equals "Y" then insert the contents of another cell

    Assuming total miles in Cell B2, Client 1 in Cell C2 , Client 2 in Cell D2

    In Client 1 formula :
    Please Login or Register  to view this content.
    is that you mean?

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If cell equals "Y" then insert the contents of another cell

    Try this...

    Let's assume the column headers are in the range A1:F1.

    Enter this formula in D2:

    =IF(C2="Y",B2,"")

    Enter this formula in F2:

    =IF(E2="Y",B2,"")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    03-27-2013
    Location
    Lancashire
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    2

    Re: If cell equals "Y" then insert the contents of another cell

    Hi

    I've managed to do it thanks.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If cell equals "Y" then insert the contents of another cell

    Good deal. Thanks for the feedback!

+ 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