Credit/Debit conditional formatting request

Hi all,
I have downloaded my online banking spreadsheets and need some help formatting the amount column into negative or positive value based on whether it's a credit or a debit.

My problem is that this spreadsheet does not display the transaction amount as negative or positive, for credits and debits, it displays all transactions as positive then in the column next to it, it indicates whether it is a credit or a debit.

I have tried to figure this out but with no luck. I need an automatic way to do a kind of:
"IF Column F reads 'credit', then convert Column D to a negative value, IF Column F reads 'debit' then leave as is (positive).

Any suggestions anyone? I'm sure it must be pretty simple!

Thx

Felix

Dual G5, Mac OS X (10.5.6), 5 GB RAM

Posted on Jul 20, 2009 12:18 PM

Reply
3 replies

Jul 20, 2009 1:22 PM in response to composerguy78

A formula may change the contents of its cell but can't use its own value.
So, you will have to use an auxiliary column , column G for instance.
In this column the formula would be:

=IF(F="credit",-D,D)
or
=IF(F="credit",D,-D)
because my guess is that you asked for the wrong setting (it seems that credit is positive and debit is negative)

Yvan KOENIG (from FRANCE lundi 20 juillet 2009 22:22:35)

Jul 21, 2009 8:11 AM in response to composerguy78

Thanks for the feedback.

here is an alternate soluce which doesn't require an extraneous column.

--

--[SCRIPT insert_sign]
(*
Enregistrer le script en tant que Script, Application ou Progiciel : insert_sign.xxx
déplacer le fichier créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
Sélectionner le bloc de cellules sources.
menu Scripts > Numbers > insert_sign
Si une cellule de la dernière colonne contient "débit" ou "debit"
le contenu (positif) de la cellule de la première colonne sera multiplié par -1..
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
+++++++
Save the script as Script, Application or Application Bundle: insert_sign.xxx
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
Select a range of cells.
Go to menu Scripts > Numbers > insert_sign
If a cell of the last column contains "debit" or "débit",
the positive contents of the cell of the first column will be multipllied by -1.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox
--=====
Yvan KOENIG (Vallauris, FRANCE)
le 21 juillet 2009
*)
--=====
on run
set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()

tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
repeat with r from rowNum1 to rowNum2
set oldVal to value of cell r of column colNum1
if (oldVal > 0) and value of cell r of column colNum2 is in {"debit", "débit"} then set value of cell r of column colNum1 to (-oldVal)
end repeat
end tell -- Numbers

end run
--=====
(*
set { dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
*)
on getSelParams()
local r_Name, t_Name, s_Name, d_Name, col_Num1, row_Num1, col_Num2, row_Num2
set {d_Name, s_Name, t_Name, r_Name} to my getSelection()

if r_Name is missing value then
if my parleAnglais() then
error "No selected cells"
else
error "Il n'y a pas de cellule sélectionnée !"
end if
end if

set two_Names to my decoupe(r_Name, ":")
set {row_Num1, col_Num1} to my decipher(item 1 of two_Names, d_Name, s_Name, t_Name)
if item 2 of two_Names = item 1 of two_Names then
set {row_Num2, col_Num2} to {row_Num1, col_Num1}
else
set {row_Num2, col_Num2} to my decipher(item 2 of two_Names, d_Name, s_Name, t_Name)
end if
return {d_Name, s_Name, t_Name, r_Name, row_Num1, col_Num1, row_Num2, col_Num2}
end getSelParams
--=====
(*
set {rowNumber, columnNumber} to my decipher(cellRef,docName,sheetName,tableName)
apply to named row or named column !
*)
on decipher(n, d, s, t)
tell application "Numbers" to tell document d to tell sheet s to tell table t to return {address of row of cell n, address of column of cell n}
end decipher
--=====
(*
set { d_Name, s_Name, t_Name, r_Name} to my getSelection()
*)
on getSelection()
local _, theRange, theTable, theSheet, theDoc, errMsg, errNum

tell application "Numbers" to tell document 1
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of tables
if x > 0 then
repeat with y from 1 to x
try
(selection range of table y) as text
on error errMsg number errNum
set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
return {theDoc, theSheet, theTable, theRange}
end try
end repeat -- y
end if -- x>0
end tell -- sheet
end repeat -- i
end tell -- document
return {missing value, missing value, missing value, missing value}
end getSelection
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
--


Yvan KOENIG (from FRANCE mardi 21 juillet 2009 17:10:26)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Credit/Debit conditional formatting request

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.