Excel Sum & Sub Based On The Condition

varunwalla

New Member
Joined
Aug 13, 2020
Messages
32
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. Mobile
  3. Web
Excel Sum & Sub Based On The Condition
  • Need to sum in Column D if the value is Yes in Column B and the value should be taken from g1
  • Need to sub in Column D if the value is No in Column B and the value should be taken from g1
  • No changes in Column D6 as this dosn't have any condition like Yes or No
Please find the Expected result reference in column E

At the moment i am able to sum by using this in D2
Code:
=ROUND(MIN((C2*100),1000),2)+G1
and sub by using this in D4
Code:
=ROUND(MIN((C2*100),1000),2)-G1

Text Based Sum.xlsx
ABCDEFG
1NameIncrementDACurrent PayExpected ResultIncrement Amount5
2RamYes5500505
3PrasadYes5500505
4ArjuanNo5500495
5RajeshNo5500495
6Dinesh5500500
Sheet1
Cell Formulas
RangeFormula
D2:D6D2=ROUND(MIN((C2*100),1000),2)
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi Varunwalla,

Can you just use IF? This works as long as column B can only be empty, Yes or No.

Varunwalla.xlsx
ABCDEFG
1NameIncrementDACurrent PayExpected ResultIncrement Amount5
2RamYes5500505
3PrasadYes5500505
4ArjuanNo5500495
5RajeshNo5500495
6Dinesh5500500
Sheet1
Cell Formulas
RangeFormula
D2:D6D2=ROUND(MIN((C2*100),1000),2)
E2:E6E2=IF(B2="",D2,IF(B2="yes",D2+$G$1,D2+($G$1*-1)))
 
Upvote 0
Hi Varunwalla,

Can you just use IF? This works as long as column B can only be empty, Yes or No.

Varunwalla.xlsx
ABCDEFG
1NameIncrementDACurrent PayExpected ResultIncrement Amount5
2RamYes5500505
3PrasadYes5500505
4ArjuanNo5500495
5RajeshNo5500495
6Dinesh5500500
Sheet1
Cell Formulas
RangeFormula
D2:D6D2=ROUND(MIN((C2*100),1000),2)
E2:E6E2=IF(B2="",D2,IF(B2="yes",D2+$G$1,D2+($G$1*-1)))

thanks for the reply but i want the result in column D not in column E
 
Upvote 0
Is this better?

Varunwalla.xlsx
ABCDEFG
1NameIncrementDACurrent PayExpected ResultIncrement Amount5
2RamYes5505
3PrasadYes5505
4ArjuanNo5495
5RajeshNo5495
6Dinesh5500
Sheet1
Cell Formulas
RangeFormula
D2:D6D2=ROUND(MIN((C2*100),1000),2)+CHOOSE(MATCH(B2,{"Yes","No",0},0),$G$1,$G$1*-1,0)
 
Upvote 0
Is this better?

Varunwalla.xlsx
ABCDEFG
1NameIncrementDACurrent PayExpected ResultIncrement Amount5
2RamYes5505
3PrasadYes5505
4ArjuanNo5495
5RajeshNo5495
6Dinesh5500
Sheet1
Cell Formulas
RangeFormula
D2:D6D2=ROUND(MIN((C2*100),1000),2)+CHOOSE(MATCH(B2,{"Yes","No",0},0),$G$1,$G$1*-1,0)

Awesome man it worked perfectly
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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