Help with "IF"

garretttpe

New Member
Joined
Feb 15, 2015
Messages
26
Hi All
Attached is a spread sheet and I want to be able to add or subtract numbers in a row if there is a I (Install) or R (removed) in the 1st cell. hard to explain and I hope seeing the spread sheet you get what I am trying to do. As of now the "weight" of the item I have to put a negative number for the row calculations to work and that is not right but the only way I know how.
thank you all very much for any help
test.xlsx
ABCDEFGHI
88/26/2021Data Transferred From Previous Chart C10,282.0231.472,380,020.41
98/26/2021Life Raft & VestsI99.8120.2011,995.9610,381.8230.402,392,016.37
108/31/2021Life Raft & VestsR-99.8120.20-11,995.9610,282.0231.472,380,020.41
119/12/2021Martin Baker Seat Right 6I15.0231.913,478.6510,297.0231.482,383,499.06
129/12/2021Martin Baker Seat Right 7I15.0242.003,630.0010,312.0231.492,387,129.06
139/12/2021Martin Baker Seat Right 8I15.0252.093,781.3510,327.0231.522,390,910.41
149/12/2021Martin Baker Seat Right 9I15.0262.183,932.7010,342.0231.562,394,843.11
159/12/2021Martin Baker Seat Right 10I15.0272.274,084.0510,357.0231.622,398,927.16
169/12/2021Martin Baker Seat Right 11I15.0282.364,235.4010,372.0231.702,403,162.56
179/12/2021Martin Baker Seat left 16I15.0246.783,701.7010,387.0231.722,406,864.26
189/12/2021Martin Baker Seat left 17I15.0266.874,003.0510,402.0231.772,410,867.31
199/12/2021Martin Baker Seat left 18I15.0286.964,304.4010,417.0231.852,415,171.71
209/12/2021Martin Baker Seat left 19I15.0307.054,605.7510,432.0231.962,419,777.46
21Martin Baker Seat left 17R-15.0266.87-4,003.0510,417.0231.912,415,774.41
22Martin Baker Seat left 18R-15.0286.96-4,304.4010,402.0231.832,411,470.01
23Martin Baker Seat left 19R-15.0307.05-4,605.7510,387.0231.722,406,864.26
24As you can see I have to make the "weight" a negative nuymber for the rest of the row to calculate and that is not correct, If there is a R in "C" then "F" should be subtracted from the previous entry "I" and opposite if there is an "I" in "C"
25
26
27
New Form C
Cell Formulas
RangeFormula
F9:F23F9=D9*E9
G9:G23G9=IF(D9=""," ",G8+D9)
H9:H23H9=IF(D9="","",I9/G9)
I9:I23I9=IF(D9="","",I8+(D9*E9))
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Your problem should be easily solvable. Just need some clarification of what formulas you are looking for.

If column C = I ... what formula do you want and where do you want the formula?
If Column C = R ... what formula do you want and where do you want the formula?
 
Upvote 0
Like this?

BTW, I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)


21 09 15.xlsm
CDEFI
82,380,020.41
9I99.8120.211995.962,392,016.37
10R99.8120.211995.962,380,020.41
11I15231.913478.652,383,499.06
12I1524236302,387,129.06
13I15252.093781.352,390,910.41
14I15262.183932.72,394,843.11
15I15272.274084.052,398,927.16
16I15282.364235.42,403,162.56
17I15246.783701.72,406,864.26
18I15266.874003.052,410,867.31
19I15286.964304.42,415,171.71
20I15307.054605.752,419,777.46
21R15266.874003.052,415,774.41
22R15286.964304.42,411,470.01
23R15307.054605.752,406,864.26
RI
Cell Formulas
RangeFormula
F9:F23F9=D9*E9
I9:I23I9=IF(D9="","",I8+IF(C9="R",-F9,F9))
 
Upvote 0
thanks for the fast response, not really working 100 percent, I will try to explain in better detail
1. If C9 is I then F9 will be D9*E9, easy part
2. If C9 is R than F9 will be D9*E9. same as above.
3. If I9 is "I" then F9 needs to be added to I8
4. If I9 is "R" then F9 needs to be subtracted from I8
C= I or R, D=weight, E=ARM, F=moment, G=new weight, H=CG, I=moment

looking to be able to add a positive number to D and the formulas do the adding or subtracting depending if C has I ( install) or R ( remove).
hope this helps, As of now I have to make "D" a negative for I to subtract and that is not correct
thank you
 
Upvote 0
How about:

Book2
ABCDEFGHIJ
88/26/2021Data Transferred From Previous Chart C10282231.472380020.41
98/26/2021Life Raft & VestsI99.8120.211995.9610381.8230.40482392016.37
108/31/2021Life Raft & VestsR99.8120.211995.9610481.6227.06652380020.41
119/12/2021Martin Baker Seat Right 6I15231.913478.6510496.6227.07342383499.06
129/12/2021Martin Baker Seat Right 7I15242363010511.6227.09472387129.06
139/12/2021Martin Baker Seat Right 8I15252.093781.3510526.6227.13042390910.41
149/12/2021Martin Baker Seat Right 9I15262.183932.710541.6227.18022394843.11
159/12/2021Martin Baker Seat Right 10I15272.274084.0510556.6227.24432398927.16
169/12/2021Martin Baker Seat Right 11I15282.364235.410571.6227.32252403162.56
179/12/2021Martin Baker Seat left 16I15246.783701.710586.6227.35012406864.26
189/12/2021Martin Baker Seat left 17I15266.874003.0510601.6227.4062410867.31
199/12/2021Martin Baker Seat left 18I15286.964304.410616.6227.49012415171.71
209/12/2021Martin Baker Seat left 19I15307.054605.7510631.6227.60242419777.46
21Martin Baker Seat left 17R15266.874003.0510646.6226.90572415774.41
22Martin Baker Seat left 18R15286.964304.410661.6226.18282411470.01
23Martin Baker Seat left 19R15307.054605.7510676.6225.43362406864.26
24As you can see I have to make the "weight" a negative nuymber for the rest of the row to calculate and that is not correct, If there is a R in "C" then "F" should be subtracted from the previous entry "I" and opposite if there is an "I" in "C"
25
26
27
Sheet1
Cell Formulas
RangeFormula
F9:F23F9=D9*E9
G9:G23G9=IF(D9=""," ",G8+D9)
H9:H23H9=IF(D9="","",I9/G9)
I9:I23I9= IF(C9="I",I8+F9,I8-F9)
 
Upvote 0
thanks
not working, if there is a "R" in row C21 then "F" needs to be subtracted from the I20 with result in I21, does this make sense
thank you all for your patience
 
Upvote 0
thanks
not working, if there is a "R" in row C21 then "F" needs to be subtracted from the I20 with result in I21, does this make sense
Not at all, because that is exactly what my last post does.
 
Upvote 0
thanks for the fast response, not really working 100 percent,
Can you identify which is the first cell in my mini-sheet in post #3 is incorrect and what the correct value in that cell should be?




I will try to explain in better detail

3. If I9 is "I" then F9 needs to be added to I8
4. If I9 is "R" then F9 needs to be subtracted from I8
Those make no sense at all to me since column I contains numbers, not R or I
 
Last edited:
Upvote 0
Can you identify which is the first cell in my mini-sheet in post #3 is incorrect and what the correct value in that cell should be?

Those make no sense at all to me since column I contains numbers, not R or C
@Peter_SSs actually it's R or I. ;)

Upon further review, your code, as well as mine, resulted in the same results. :)

Not sure what @garretttpe is looking for, both of our formulas give what was asked for. :rolleyes:
 
Upvote 0
@Peter_SSs actually it's R or I. ;)
Thanks for picking up that typo. I've fixed it in my post so that it makes sense there now.

Upon further review, your code, as well as mine, resulted in the same results.
Yes, I couldn't see that you were suggesting anything different to me (except not checking if col D was empty ;))
 
Upvote 0

Forum statistics

Threads
1,216,300
Messages
6,129,978
Members
449,547
Latest member
RichieRichJPN

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