ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot Table - Using If Then logic (https://www.excelbanter.com/excel-programming/413902-pivot-table-using-if-then-logic.html)

blkane

Pivot Table - Using If Then logic
 
Can you use If Then logic in a calculated field?

I have table of data that is downloaded from an external source. The amount
field is all positive numbers. The adjacent field indicates if the amount
represents a debit or credit value.

I would like to set up a calculated field that to sum the amount field but I
need to have the debit and credits sum to a net number and not a straight sum.

Any thoughts on this? I'm trying to avoid manipulating the entire table to
change the sign on the credit values.

thanks

Jim Thomlinson

Pivot Table - Using If Then logic
 
You can not use if then logic in a pivot table. You need to add the logic to
your source data.
--
HTH...

Jim Thomlinson


"blkane" wrote:

Can you use If Then logic in a calculated field?

I have table of data that is downloaded from an external source. The amount
field is all positive numbers. The adjacent field indicates if the amount
represents a debit or credit value.

I would like to set up a calculated field that to sum the amount field but I
need to have the debit and credits sum to a net number and not a straight sum.

Any thoughts on this? I'm trying to avoid manipulating the entire table to
change the sign on the credit values.

thanks


Mike H.

Pivot Table - Using If Then logic
 
If using VBA, I would replace the amount column with the new "adjusted" amount:

let's say Col I has the Amount and Col J has "Dr" or "Cr"

code:
x=1
Do while true
if cells(x,1).value=empty then exit do 'something to find last row of
data, may
'have to adjust
let Amt=cells(x,9).value
if cells(x,10).value="Dr" then
'do nothing, it is positive!
else
let cells(x,9).value=-1*amt
end if
x=x+1
Loop


"blkane" wrote:

Can you use If Then logic in a calculated field?

I have table of data that is downloaded from an external source. The amount
field is all positive numbers. The adjacent field indicates if the amount
represents a debit or credit value.

I would like to set up a calculated field that to sum the amount field but I
need to have the debit and credits sum to a net number and not a straight sum.

Any thoughts on this? I'm trying to avoid manipulating the entire table to
change the sign on the credit values.

thanks



All times are GMT +1. The time now is 02:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com