+ Reply to Thread
Results 1 to 4 of 4

Sum of one column, but the numbers being calculated could change based on another column

  1. #1
    Registered User
    Join Date
    12-12-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    92

    Sum of one column, but the numbers being calculated could change based on another column

    I have an issue trying to calculate the sum of A1:A22. Here is information regarding what I am trying to do:

    A1:A22 are numbers ranging from 1-10.
    B1:B22 are numbers ranging from 0-200.

    If a number in B1:B22 is greater than or equal to 120 the number in the correlating A cell is divided by 2 unless the number in the A cell is 1 then 1 would be subtracted.

    Example:

    A1 is 7, B1 is 122. Sum = 3.5
    A2 is 1, B2 is 120. Sum = 0
    A3 is 4, B3 is 14. Sum = 4
    Total 7.5 round up to 8.

    I hope this make sense.

    The formula is being entered in Cell C1

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Sum of one column, but the numbers being calculated could change based on another colu

    Try this in C1:

    =IF(B1>120,IF(A1=1,0,A1/2),A1)

    You didn't specify what is to happen if B is less than or equal to 120, but your third example seems to suggest that you just want the value of A.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    12-12-2013
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Sum of one column, but the numbers being calculated could change based on another colu

    You are correct in your assumption. For this to check cells B1:B22, I would repeat the formula for each one correct? Or would you recommend a cheater column to add them up instead of a long If formula?

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Sum of one column, but the numbers being calculated could change based on another colu

    Because of the way you had laid out the examples, I assumed you would copy the formula down to C22, and then use a simple SUM formula to get the overall result:

    =SUM(C1:C22)

    You could get the result in a single array* formula, like this:

    =SUM(IF(B1:B22>120,IF(A1:A22=1,0,A1:A22/2),A1:A22))

    and as this is an array* formula you need to commit it using the key combination of Ctrl-Shift-Enter (CSE) instead of the usual < Enter >.

    Hope this helps.

    Pete

+ 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: 6
    Last Post: 07-06-2014, 10:19 PM
  2. Add numbers to column based on order number change
    By fpmsi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2013, 11:48 AM
  3. Replies: 2
    Last Post: 07-08-2013, 08:37 PM
  4. [SOLVED] Restart and increment numbers in column based on changed value in adjacent column
    By Kespin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2013, 06:26 PM
  5. Change formula in a calculated column
    By jphalverson in forum Excel General
    Replies: 5
    Last Post: 07-14-2012, 12:24 PM
  6. Replies: 8
    Last Post: 02-16-2011, 05:03 PM
  7. How can I change column numbers back to column letters?
    By Space Elf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-02-2006, 05:40 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