+ Reply to Thread
Results 1 to 2 of 2

Find and Add Numbers if Referenced on Another Worksheet

  1. #1
    Registered User
    Join Date
    11-16-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2010
    Posts
    1

    Find and Add Numbers if Referenced on Another Worksheet

    Hello everyone! I have a (hopefully) quick question. I'm not new to Excel, but I'm not very familiar with many of its lesser known commands or VBA scripting. Here's the scenario:

    I'm attempting to model a messy web of water pipes using Excel. On one worksheet (let's call it "Input") I have a list of 300 junctions where pipes connect. Each junction is labeled as a text string (so something like "GW34"). At each listing for each junction, it lists the next junction downstream (also as a text string) in the next column on the sheet. Along with that, I have a quantity of water that is flowing through the pipe (a numerical value) in the next column on that sheet.

    On another worksheet (let's call it "Calculations") I want to be able to find the quantity of water combining at each junction by summing the quantity coming from the upstream junctions. So, what I want to be able to do, is find the data on sheet "Input" that references a specific junction to add the water that is combining at that point. In other words, I want to be able to do something like this (in a combination of English and old programming languages):

    Dim i as an integer = 1
    Dim TotalWater as an integer = 0

    For (i=1; go to i=300; i++)
    If (theReferencingColumnOnSheetInput on row i = "GW34")
    Then (take the value of the water quantity on row i and add it to TotalWater)
    End For Loop

    Print TotalWater in its specific cell on the sheet of Calculations

    So it will basically run through the list (column) of references on sheet "Input" and anytime it finds the name of the junction it adds its water quantity to the TotalWater value and puts it in specific cell on the "Calculations" sheet.

    Confused yet? I am. Thanks for any help!

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Find and Add Numbers if Referenced on Another Worksheet

    Hi

    From my reading, you should be able to do this with the SUMIF function.

    If that doesn't work, then put up an example workbook, showing example data, the expected output, and how it was achieved.

    rylo

+ 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