+ Reply to Thread
Results 1 to 5 of 5

Counting the sum of a cell based on an adjacent cells value

  1. #1
    Registered User
    Join Date
    05-18-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    3

    Counting the sum of a cell based on an adjacent cells value

    Hi all!

    I'm a quantity surveyor using excel on a daily basis trying to figure out another formula to make my workflow more efficient.

    My current problem is the sheet in which i measure drainage.

    Drainage Excel.png

    I have conditional formatting on column E, which puts the cell at a specific colour based on the 'average depth' of the drainage. This way i can quickly see which lengths are at which depths.

    AC to AE is my collection. All lengths are added up which are at the relevant depths, but i have to manually select each length in column J. Sometimes due to the colours being similar or me trying to be too quick, it's easy to miss a cell or select one too many, which then takes a while to mitigate so everything tallies up again.

    MY QUESTION!

    Is there a way to use COUNTIF in a way that counts the value in column J IF the value in column E is between 2 figures.

    e.g. if column E is between 0.1-0.5, include the length in column J. Total in AE6 etc.

    Thanks!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Counting the sum of a cell based on an adjacent cells value

    1. change your summary table so each range (eg 0.25-0.50) starts at the lower end of the range (the way you have it, those are text entries not values)
    2. You could then use countifS to run your counts.

    If you will have a problem, upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    05-18-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    3

    Re: Counting the sum of a cell based on an adjacent cells value

    Thanks for your response!

    I think i have attached a small representation of what i'm looking at.

    I need a formula for 'Total(m)' to add the 'Length(m)' based on the 'AV Depth' into the corresponding depths.

    I've included in my sheet what i do currently, but imagine there are hundreds of lines, this can be quite tedious!

    I'm not too sure how to use the CountIf. If you could give me a hand i'd really appreciate it!
    Attached Files Attached Files

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Counting the sum of a cell based on an adjacent cells value

    Thanks for the file and apologies for the delayed reply.

    1. Your 1st range is 0.25 - 0.5, yet all of the values you include in your sum are below 0.25?
    2. Would you be OK with just including the lower end of each range, like I suggested above? If necessary, you cane have a 2nd column to show the upper range.

    I have attached your file with the suggested formula, but basically I added a helper column (J) to split your ranges, then used SUMIFS in K (I changed the value in E13 to 2.3 to test the last formula)...
    J
    K
    2
    Depth Total (m)
    3
    0
    6
    4
    0.25
    0
    5
    0.5
    1
    6
    0.75
    1
    7
    1
    1
    8
    1.25
    0
    9
    1.5
    0
    10
    1.75
    0
    11
    2
    0
    12
    2.25
    1
    13

    K3=SUMIFS($F$4:$F$13,$E$4:$E$13,">="&J3,$E$4:$E$13,"<"&J4)
    copied down
    EXCEPT FOR k12, AS IT HAS NO UPPER LIMIT...
    K12=SUMIFS($F$4:$F$13,$E$4:$E$13,">="&J12)
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-18-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    3

    Re: Counting the sum of a cell based on an adjacent cells value

    This has worked a treat! that's amazing. I really appreciate it!

+ 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: 3
    Last Post: 10-20-2016, 02:06 PM
  2. Copy non-adjacent cells based on value in another cell
    By pab61 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-13-2015, 12:28 PM
  3. Counting blank cells based on non adjacent criteria
    By FrankMcG in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-30-2013, 04:47 PM
  4. Counting cells based on values of adjacent cells
    By SpookyAlienX in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-26-2013, 08:20 PM
  5. [SOLVED] Sum cells based on value in adjacent cell
    By balston2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2013, 11:23 AM
  6. [SOLVED] Combining cells based on value of adjacent cell.
    By Gav-UK in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-21-2012, 07:08 AM
  7. Counting cells with a criteria based on content and adjacent cell
    By ziggy12345 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-03-2008, 03:32 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