Hi,
I was wondering how this would be possible. I come across this kind of problem very often so finding a solution would be amazing!!
I need to subtract the second row from the first row for each well in my access query.
I have data with three fields.
[Name]
[Surface]
[Depth]
This is the table I have
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Surface[/TD]
[TD]Depth[/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]A[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]B[/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]C[/TD]
[TD]34[/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]D[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]A[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]B[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]C[/TD]
[TD]25[/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]D[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
What I need: I need to subtract the second row [Depth] from the first row [Depth] for each well in [Name]
As you see below I call this field [Thickness] =SecondRow[Depth]-FirstRow[Depth]
I also drop the row which has last or Max [Depth] for each well in [Name] because I am calculating the thickness and keeping the final row would be redundant.
(this part can be left out if it is too complicated)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Surface[/TD]
[TD]Depth[/TD]
[TD]Name[/TD]
[TD]Surface[/TD]
[TD]Depth[/TD]
[TD]Thickness[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]A[/TD]
[TD]12[/TD]
[TD]Well1[/TD]
[TD]B[/TD]
[TD]20[/TD]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]B[/TD]
[TD]21[/TD]
[TD]Well1[/TD]
[TD]C[/TD]
[TD]30[/TD]
[TD]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]C[/TD]
[TD]34[/TD]
[TD]Well1[/TD]
[TD]D[/TD]
[TD]40[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]A[/TD]
[TD]5[/TD]
[TD]Well2[/TD]
[TD]B[/TD]
[TD]15[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]B[/TD]
[TD]15[/TD]
[TD]Well2[/TD]
[TD]C[/TD]
[TD]25[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]C[/TD]
[TD]25[/TD]
[TD]Well2[/TD]
[TD]D[/TD]
[TD]35[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Any help is greatly appreciated!
Thanks!
I was wondering how this would be possible. I come across this kind of problem very often so finding a solution would be amazing!!
I need to subtract the second row from the first row for each well in my access query.
I have data with three fields.
[Name]
[Surface]
[Depth]
This is the table I have
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Surface[/TD]
[TD]Depth[/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]A[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]B[/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]C[/TD]
[TD]34[/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]D[/TD]
[TD]40[/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]A[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]B[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]C[/TD]
[TD]25[/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]D[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
What I need: I need to subtract the second row [Depth] from the first row [Depth] for each well in [Name]
As you see below I call this field [Thickness] =SecondRow[Depth]-FirstRow[Depth]
I also drop the row which has last or Max [Depth] for each well in [Name] because I am calculating the thickness and keeping the final row would be redundant.
(this part can be left out if it is too complicated)
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Surface[/TD]
[TD]Depth[/TD]
[TD]Name[/TD]
[TD]Surface[/TD]
[TD]Depth[/TD]
[TD]Thickness[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]A[/TD]
[TD]12[/TD]
[TD]Well1[/TD]
[TD]B[/TD]
[TD]20[/TD]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]B[/TD]
[TD]21[/TD]
[TD]Well1[/TD]
[TD]C[/TD]
[TD]30[/TD]
[TD]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well1[/TD]
[TD]C[/TD]
[TD]34[/TD]
[TD]Well1[/TD]
[TD]D[/TD]
[TD]40[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]A[/TD]
[TD]5[/TD]
[TD]Well2[/TD]
[TD]B[/TD]
[TD]15[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]B[/TD]
[TD]15[/TD]
[TD]Well2[/TD]
[TD]C[/TD]
[TD]25[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Well2[/TD]
[TD]C[/TD]
[TD]25[/TD]
[TD]Well2[/TD]
[TD]D[/TD]
[TD]35[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Any help is greatly appreciated!
Thanks!