Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Summation in Excel formula

Status
Not open for further replies.

Geosubhtech

Geotechnical
Jan 2, 2018
57
Greetings of the day....

I am trying to make one dynamic SUM in excel.
i want to input the different depths in G & H column. The layers with SAND thickness should be returned in I column. the extra difference also should be included with in.

1_puqck5.png



The sample file i have attached. I tried some approach but it;s very complex and need continuous check.

Can anyone help me with this?

Link
 
Replies continue below

Recommended for you

It would help if you would upload your workbook.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Ok, so what specific questions do you have?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Is it possible to make some (more simple to decipher) formula which will work if my row 3 to 10 is changed to row 3 to 17.
 
You need to explain your desire in more detail. At least, show in your spreadsheet what values are to be calculated from which inputs. I can't read your mind, and the numbers you have the sheet don't seem to correlate to anything

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! faq731-376 forum1529 Entire Forum list
 
What version of Excel - there are features that can make this much easier but only appear in later versions.
 
I think I understand what you are wanting.

First, you stated that your table is growing. I assume you mean the table in columns A:D. I made that table a Structured Table so that ALL the formulas now use Structured Table References, so it doesn't matter how many layers your table has. The Structured Table default name is Table1. No more A1 notation for table references. And BTW, your original references to those ranges were all INCORRECT!

If the last row of your table is a "Sand" Material, you must add a "Non Sand" row. My example shows such a row. Failing to do so will result in an incorrect summation.

The OFFSET() function was complicating your approach. Rather, I am using INDEX & MATCH to locate the first/last occurrence of Material based on your X value (Sand or not). INDEX & MATCH are used on the First & Last layers.

The Material Thickness calculations are using SUMPRODUCT() rather than SUMIFS(), which in my pea brain mind, is so much easier to 1) code and 2) intuitively understand. Total sand with in X & Y use SUMPRODUCT().

I've uploaded you workbook revised.

Here are the formulas for columns I, K & J:
[pre]
From X to 1st layer:
=IF
(
INDEX(Table1[Material],MATCH(G2,Table1[From],1),1)="Sand",
MIN(H2-G2,INDEX(Table1[to],MATCH(G2,Table1[From],1),1)-G2),
0
)

Total sand with in X & Y:
=SUMPRODUCT
(
(Table1[Thicknes (m)])*
(Table1[Material]="Sand")*
(Table1[to]<=H2)*
(Table1[From]>G2)
)

last layer available up to Y:
=IF
(
AND(
INDEX(Table1[Material],MATCH(H2,Table1[From],1),1)="Sand",
MATCH(G2,Table1[From],1)<>MATCH(H2,Table1[From],1)
),
H2-INDEX(Table1[From],MATCH(H2,Table1[From],1),1),
0
)
[/pre]

et-sand_calc_ebbzhe.png

Let me know if I miss-interpreted your intentions or if you need an better explanation of what these expressions are doing.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Hey, ShubhP, I think I answered all you questions a day after your last post.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Yes sir.
It helped a lot. Saved lot of time. I have added some filters in to it and works very well.

Many many thanks to you for the help & giving your time.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor