+ Reply to Thread
Results 1 to 4 of 4

Looping through rows and manipulating references

  1. #1
    Forum Contributor
    Join Date
    06-28-2010
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    101

    Looping through rows and manipulating references

    Hi,

    Could someone help me with the following query please?

    If I have a column with data of the following:
    A1 : 0
    B1 : 0
    C1 : 0
    V1 : 1

    A2 : 1
    B2 : 0
    C2 : 0
    V2 : 1

    A3 : 1
    B3 : 0
    C3 : 0
    V3 : 0

    And I want to sum the values of Vx where Ax > 0. How would I do this? The above example would result in 1 (V2 + V3) because A2 and A3 > 0.

    I've been trying to modify:
    http://www.excelforum.com/excel-work...-a-column.html

    However, I cannot find how to convert a result into a cell reference i.e. what to put at "???"
    Please Login or Register  to view this content.
    Many thanks,

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Looping through rows and manipulating references

    I want to sum the values of Vx where Ax > 0
    Try this formula to sum the first 100 values in column V where column A > 0.

    =SUMPRODUCT(--(A1:A100>0), V1:V100)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    06-28-2010
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    101

    Re: Looping through rows and manipulating references

    Ah I see thanks. So I'd have to put the data in multiple columns so Vx was next to Ax.

    In the end I created a macro to just alert the values and manually filled them in (ouch, but done). If anyone is interested it is below. Ugly hard coding and magic numbers, but just needed something quick.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Looping through rows and manipulating references

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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