1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Macro to sum 3 columns using a loop

Discussion in 'Business Applications' started by TrauTs-Art, Jan 22, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. TrauTs-Art

    TrauTs-Art Thread Starter

    Joined:
    Jan 19, 2013
    Messages:
    3
    Hi All, fantastic site.

    I need to run a macro in excel to sum the following.

    check row 3 col 3 or row 3 col 4 for a value > 0 then subtract this value from row 3 col 5 return answer to Row 3 col 6 if col 5 cell is empty then go to previous cell that has a value >0 return this value to Col 6 on the same row as col 3 or 4 (the one with a value >0)
    There should be an answer in every row col 6 this could run upto 100 rows+

    Hopefully i've explained myself engough for you to understand. Ta
     
  2. Garf13LD

    Garf13LD

    Joined:
    Apr 17, 2012
    Messages:
    455
    @F3
    =if(E3,E3-max(C3:D3),max(C3:D3))
     
  3. TrauTs-Art

    TrauTs-Art Thread Starter

    Joined:
    Jan 19, 2013
    Messages:
    3
    I have place the formula in column F row 2 dragged it down and all I get is "false" nice trt but that did not seam to work.

    My problem starts at row 5.

    I have data in colC row 4 & 5, col D row 3 , 6, 7 colE row 2,3,6 allthe remaining in between are zero. Starting with col F row 3 the formula I've entered is = E2-D2 then moving down to the next cell same column row 4 the formula is =E3-C4, then moving down to the next cell I have E3-C5 as you can see I have to go back to E3 becouse E4 = 0 also does E5 so on and so on. What I 'm looking to achieve is when column E has a zero then the previous cell that is >0 needs to be used however the sequence needs to remain eg E6 E7 E8 as there will always be a value >0 in column 5.

    Thanks for your efforts
     
  4. Garf13LD

    Garf13LD

    Joined:
    Apr 17, 2012
    Messages:
    455
    Pls attach a sample file
     
  5. TrauTs-Art

    TrauTs-Art Thread Starter

    Joined:
    Jan 19, 2013
    Messages:
    3
    Please see attached file, hopefully this will help resolve.
     

    Attached Files:

  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1086414

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice