Subtract a number according to Drop Down list options

PhilipeC

Board Regular
Joined
May 1, 2018
Messages
56
I would like to subtract a number according to Drop Down list options. My Drop Down list is in colums B4 to B20 and each column has the same tree options: A-B-C , and there are columns D4 to D20 and F4 to F20 each column with numbers in reference to those options. Columns G4 TO G20 are the subtraction results. IF option A is chosen i want to subtract F(column number) - D(Column number) = G(Column number) , If option B is chosen i want to subtract to subtract D(Column number) - F(Column number) = G(Column number), option C would be the same as B, subtract D(Column number) - F(Column number) = G(Column number). Just an example: in column B4 i choose option B from the Drop down list, than: D4 - F4 = G4.
Thank you
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I would like to subtract a number according to Drop Down list options. My Drop Down list is in colums B4 to B20 and each column has the same tree options: A-B-C , and there are columns D4 to D20 and F4 to F20 each column with numbers in reference to those options. Columns G4 TO G20 are the subtraction results. IF option A is chosen i want to subtract F(column number) - D(Column number) = G(Column number) , If option B is chosen i want to subtract to subtract D(Column number) - F(Column number) = G(Column number), option C would be the same as B, subtract D(Column number) - F(Column number) = G(Column number). Just an example: in column B4 i choose option B from the Drop down list, than: D4 - F4 = G4.
Thank you
G4 =IF(A4="A",F4-D4,IF(OR(A4="B",A4="C"),D4-F4))

Copy through G20 ;)
 
Upvote 0
Even this should work
Code:
=IF(B4="A",F4-D4,D4-F4)
But the right column to check is B, not A. You are right (y)


=IF(B4="A",F4-D4,IF(OR(B4="B",B4="C"),D4-F4),"")
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,215,409
Messages
6,124,730
Members
449,185
Latest member
ekrause77

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