excel /vba help - Substraction not working

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
853
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

I am trying to substract Column F value from column B.
giving me incorrect output. =F2--B2

When tried =D2--A2 gives me Correct output.

looking your help in excel formula or vba both ok. thanks

Below is a snapshot Column G gives wrong output, expected output shown in H2:H3.

Book7
ABCDEFGH
1 Outstanding Balance Bal as per SAP Sum Amt Difference Today's Balance Difference
2 5,317.59 307.26 -5317.59 - 307.26 614.52 Expected - 0 value in G2
3 5,000.00 4,000.00 -5000 - 5,000.00 9,000.00 Expected - 1000 in G3
4
5=D2--A2=F2--B2
Sheet1
Cell Formulas
RangeFormula
E2:E3E2=D2--A2
G2:G3G2=F2--B2



Thanks
mg
 

Some videos you may like

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,483
Office Version
  1. 365
Platform
  1. Windows
Hi, you just need one minus sign in your formula i.e.

=F2-B2
 

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
853
Office Version
  1. 2010
Platform
  1. Windows
Hi FormR,

I want to use same formula in both Difference Column.

if I use single minus sign, in One Difference columns formula gives correct output.
in other Column it gives wrong output.


Thanks
mg
 

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,483
Office Version
  1. 365
Platform
  1. Windows
in other Column it gives wrong output.

Hi, sorry, but that doesn't give enough information about what you want to do to be able to make a new suggestion.
 

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
853
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

Hi FormR,

Thanks for looking into my query. I used the formula suggested by you.
Column E is giving incorrect value.

Below is screenshot with formula in Column E and G.

Book7
ABCDEFG
1 Outstanding Balance Bal as per SAP Sum Amt Difference Today's Balance Difference
2 5,317.59 307.26 -5317.59 -10,635.18 307.26 -
3 5,000.00 4,000.00 -5000 -10,000.00 5,000.00 1,000.00
4
5=D2-A2=F2-B2
6
7Expected - 0 value in e2
8Expected - 1000 in E3
Sheet1
Cell Formulas
RangeFormula
E2:E3E2=D2-A2
G2:G3G2=F2-B2



Thanks
mg
 

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,483
Office Version
  1. 365
Platform
  1. Windows
Can't you just use your existing formula in column E?
 

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
853
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

Hi FormR,

I can, But I am creating vba macro to the end user, and my next course of action depend on minus values.
So needs same logic/formula for both the columns.



Thanks
mg
 

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,483
Office Version
  1. 365
Platform
  1. Windows
But I am creating vba macro to the end user, and my next course of action depend on minus values.

It's not clear why that would make any difference but how about something like.

=A2-ABS(D2)
 

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
853
Office Version
  1. 2010
Platform
  1. Windows
Hi FormR,

Thanks for your help, it worked as expected. (y)

Thanks
mg
 

Watch MrExcel Video

Forum statistics

Threads
1,127,651
Messages
5,626,090
Members
416,161
Latest member
David1966Lewis

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
Top