+ Reply to Thread
Results 1 to 9 of 9

Finding difference among multiple constant columns and one variable column

  1. #1
    Registered User
    Join Date
    12-16-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    41

    Finding difference among multiple constant columns and one variable column

    Hello,

    I apologize if the title is a bit confusing but hopefully I can clear it up. Essentially what I'm looking to do is the following:

    There are 4 machines (A, B, C, and D) that have different target production rates and the machines operate at times 1:00, 2:00, 3:00....10:00. Only one machine is running at a time. The operator fills in the actual production that occurs on a sheet which also contains the targets for each machine. I would like to find the difference between the target production and the actual production of the machines without having to change the formula in the 'Difference' column every time the machine changes.

    You'll see in the attached spreadsheet that 'Difference' is calculated by subtracting the target from the actual and varies by subtracting F-(A or B or C or D) depending on the machine that is running. However, the formula is changed manually each time the machine changes. Is there a way to have it automatically change based on certain conditions, etc? The cells have been color-coded to identify which machine is running during a specific time frame.

    Thanks in advance and let me know if I should elaborate!

    Sample.xlsx

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,044

    Re: Finding difference among multiple constant columns and one variable column

    Hi and welcome to the forum

    I take it that the machines change after 10 hours? Is the change from machine to machine sequential...1 to 2 to 3 to 4 to 1...etc?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    12-16-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Finding difference among multiple constant columns and one variable column

    No, sorry for misleading you!

    The machines don't always change after 10 hours. They can run for any amount of time (2, 3, 14, etc) before changing. Also, there is no sequence between machines - it's entirely random!

    Attached is an updated version reflecting the "new" conditions. Thanks for the welcome and speedy response!

    Sample_Updated.xlsx

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,044

    Re: Finding difference among multiple constant columns and one variable column

    OK so how on earth would we know which machine to use then?

  5. #5
    Registered User
    Join Date
    12-16-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Finding difference among multiple constant columns and one variable column

    What I initially thought could work would be a simple formula such as 'Difference' = F - A - B - C - D. Then you would just delete the values of target production that you are not using.

    For example, G3 = F3 - A3 - B3 - C3 - D3. Delete A3, B3, and D3 (because you aren't using those machines) and thus you would have G3 = F3-C3 = -1. This works in theory but isn't pragmatic with large data sets.

    I was hoping there would be an easier way to identify which machine is being used and have a formula based on that identification. Would it be possible to highlight cells with a certain fill color and then have the formula calculate based on which cells are colored? That's the kind of direction I'm thinking but am definitely open to any suggestions.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,044

    Re: Finding difference among multiple constant columns and one variable column

    Unless you have some indicator as to which machine was working..........................

    Look at it this way. Take away those color (you entered those colors manually?), and how would you tell if the 49 in F20 was from Machine A or machine D?

    I suggest you add a column and use a code/letter/something to indicate the machine, otherwise, it looks like it is guesswork

  7. #7
    Registered User
    Join Date
    12-16-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Finding difference among multiple constant columns and one variable column

    Alright, I think we're on the same page now. Currently the operators simply circle the machine so I've attached an updated file with a column identifying which machine is in use.

    I went ahead and wrote an IF function for the calculation which makes use of the new column 'Machine'.

    'Difference' =IF(G3="A", F3-B3, IF(G3="B", F3-C3, IF(G3="C",F3-D3, F3-E3)))

    It works, but is not very eloquent. Any cleaner solution?


    Thanks!

    Sample_Updated2.xlsx

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Finding difference among multiple constant columns and one variable column

    Here is one way that might work for you. I added two helper columns. Column B identifies the machine and column K is the combination of the time and the machine to produce a unique identifier.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,044

    Re: Finding difference among multiple constant columns and one variable column

    Try this slightly shorter version...
    =F3-INDEX(B3:E3,MATCH(G3,$B$2:$E$2,0))

    (I have a feeling that your machines are not A, B, D D though, but maybe this method can still be adapted - for G, create a drop-down with the machine names and use that inthe formula above, if you dont want to use A, B etc)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 12-19-2013, 10:00 AM
  2. Finding difference between three columns
    By wallywalter in forum Excel General
    Replies: 4
    Last Post: 05-14-2012, 01:12 PM
  3. Replies: 4
    Last Post: 01-14-2011, 09:30 PM
  4. SendMail to multiple recipients, one variable, and one constant
    By Craig in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2006, 07:40 PM
  5. Replies: 4
    Last Post: 07-26-2005, 10:05 PM

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