formula to multiple by -1 based on two unique conditions

y3tter

Board Regular
Joined
Nov 11, 2012
Messages
147
I have a sheet that lists geological formations with their vertical depth(in column C), in multiple locations. The locations are separated into groups and are identified that way in column A(Group 1, Group 2, Group 3, etc). Towards the middle of each group has the target geological formation of interest. I am wanting a formula in column D that subtracts the vertical depths and define how thick each formation is, but if it is listed as target or below, in each group, to multiply by negative one and if it is the last formation in the group to leave the cell blank.

I attached a small table for visual reference, column D is where I am wanting to have the formula.

https://www.dropbox.com/s/bx6kjdgltzciham/formation.xlsx?dl=0
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
So for D2, would it multiply by -1 because 24 is less than 8930? or what?



Excel 2010
ABCD
1GroupsFormationTVDthickness
2Test OneCSTR879724
3Test OneMRMC882136.5
4Test OneMRMC E8857.545.5
5Test OneMRMC D890314.5
6Test OneMRMC B8917.512.5
7Test OneTarget893062
8Test OneTarget Base89925.5
9Test OneMRMC LS8997.528.5
10Test OneWDFD90266.5
11Test OneWDFD Chert9032.517.5
12Test OneWDFD Chert Base905047.5
13Test OneWDFD MID9097.5-297.5
14Test TwoCSTR880018
15Test TwoMRMC881842
16Test TwoMRMC E886042
17Test TwoMRMC D890214
18Test TwoMRMC B891615
19Test TwoTarget893163
20Test TwoTarget Base89944
21Test TwoMRMC LS899828
22Test TwoWDFD90264
23Test TwoWDFD Chert903018
24Test TwoWDFD Chert Base904849
25Test TwoWDFD MID9097
Sheet1
 
Upvote 0
I needed 2 columns for this.

E2 =IF(COUNTIF(A:A,A2)=COUNTIF($A$1:A2,A2),"",IF(OR(B2="Target",E1="AB"),"AB","BL"))
F2 =IF(E2="BL",C3-C2,IF(E2="AB",-(C3-C2),""))
 
Upvote 0
No, 24 is the value the formula should come up with. The formula would have to look for "Target" in column B and all formations including it and below would be multiplied by negative one, until it reaches the next group, "Test Two" in column A. D7:D12 would be multiplied by negative 1 and D13 would be blank, since it is the last formation in the Group "Test One"(Column A). D19:D24 would also be multiplied by negative one and D25 would be blank
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top