Results 1 to 2 of 2

Calculate values in two columns based on a value in a third column

Threaded View

  1. #1
    Registered User
    Join Date
    10-31-2013
    Location
    Golden, CO
    MS-Off Ver
    Excel 2010
    Posts
    43

    Calculate values in two columns based on a value in a third column

    Newbie here and I am uncertain how to go about setting up this macro, so my apologies in advance. For each similar value in Column AA, I would like to sum the values in Column Y and then subtract the values in Column X and put the calculated value into Column Z. I have attached an example of what I am looking for. All I've got so far is a recorded macro, so I'm open towards going in a different direction. Any help would be greatly appreaciated.

    Sub Sum
        Selection.FormulaR1C1 = "=SUM(RC[-1])"
        ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
        Range("Z7").Select
        ActiveCell.FormulaR1C1 = "=SUM(R[-4]C[-1]:RC[-1])-SUM(R[-4]C[-2]:RC[-2])"
        Range("Z18").Select
        ActiveCell.FormulaR1C1 = "=SUM(R[-10]C[-1]:RC[-1])-SUM(R[-10]C[-2]:RC[-2])"
        Range("Z19").Select
        ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
        Range("Z23").Select
        ActiveCell.FormulaR1C1 = "=SUM(R[-3]C[-1]:RC[-1])-SUM(R[-3]C[-2]:RC[-2])"
        Range("Z24").Select
        ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
        Range("Z24").Select
        Selection.Copy
        Application.CutCopyMode = False
        Range("Z25").Select
        ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
        Range("Z26").Select
        ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
        Range("Z27").Select
        ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
        Range("Z28").Select
        ActiveCell.FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
        Range("Z29").Select
    End Sub
    Thanks in advance,
    Ray
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Can you calculate columns based on specific text in a different column?
    By CenterShock in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-16-2014, 03:52 PM
  2. Calculate mean of column B values based on date values in column A
    By up&down in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-05-2013, 12:26 PM
  3. Calculate Values in a row based on value of first column
    By travisg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-31-2013, 01:39 PM
  4. Replies: 4
    Last Post: 12-12-2012, 11:26 AM
  5. Replies: 4
    Last Post: 12-12-2012, 10:37 AM

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