Convert "CR" Into Negative Numbers

hardeep.kanwar

Well-known Member
Joined
Aug 13, 2008
Messages
693
Dear All,

I have Account Data with "DR" & "CR" Format


Excel Workbook
A
1Balance
230.00 Cr
350.00 Cr
43500.00 Cr
550.00 Cr
63300.00 Cr
73333.00 Cr
80.80 Dr
970.00 Dr
103500.00 Dr
113500.00 Dr
123312.00 Dr
1360.00 Cr
1490.00 Cr
153200.00 Cr
1684.00 Dr
1715.00 Cr
183150.00 Cr
Sheet1



What i Need to Convert "CR" Numbers Into Negative

Excel Workbook
AB
1BalanceExpected Result
230.00 Cr(300)
350.00 Cr(500)
43500.00 Cr(3500)
550.00 Cr(50)
63300.00 Cr(3300)
73333.00 Cr(3300)
80.80 Dr
970.00 Dr
103500.00 Dr
113500.00 Dr
123312.00 Dr
1360.00 Cr(600)
1490.00 Cr(90)
153200.00 Cr(3200)
1684.00 Dr
1715.00 Cr(15)
183150.00 Cr(3150)
Sheet1



Is it Possible with Formula


Thanks In Advance
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
What is the EXACT custom format that you are using to show Cr / Dr in the cells?

That googledocs link is still restricted access.
 
Upvote 0
Hardeep has explained the problem to me via correspondence on his Google Document. I will explain here so that members may be able to come up with a solution.

His data column B is numbers all positive. Each cell is formatted with a number format. 0.00" cr" if the cell is a Credit and 0.00" dr" if the call is a debit.

He basically wants to convert these values into positive and negative values. I imagine it could be done by a macro looking at the format of each cell in the column and converting the data to positive or negative accordingly.
 
Upvote 0
What is the EXACT custom format that you are using to show Cr / Dr in the cells?

That googledocs link is still restricted access.

""0.00" Cr" For Credit

""0.00" Dr" For Debit

Dr cells are formatted one way and the Dr cells are formatted another
 
Upvote 0
<b>Excel 2010</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB"><colgroup><col width="10px" style="background-color: #DAE7F5" /><col /><col /></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th></th><th>A</th><th>B</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="font-weight: bold;;">Value</td><td style="font-weight: bold;;">Required Result</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="text-align: right;;">26500.00 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;">26500.00 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="text-align: right;;">125500.00 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style="text-align: right;;">12000.00 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style="text-align: right;;">45904.40 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: right;;">6000.00 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: right;;">75618.40 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: right;;">4000.00 Cr</td><td style="text-align: right;;">-4000</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style="text-align: right;;">810.00 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style="text-align: right;;">6000.00 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style="text-align: right;;">100000.00 Cr</td><td style="text-align: right;;">-100000</td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style="text-align: right;;">6000.00 dr</td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style="text-align: right;;">198540.00 dr</td><td style=";"></td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">B2</th><td style="text-align:left">=IF(<font color="Blue">ISNUMBER(<font color="Red">SEARCH(<font color="Green">" cr",Cell_Format</font>)</font>),A2*-1,""</font>)</td></tr></tbody></table></td></tr></table><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Workbook Defined Names</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><th width="10px">Name</th><th style="text-align:left">Refers To</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">Cell_Format</th><td style="text-align:left">=GET.CELL(<font color="Blue">7,INDIRECT(<font color="Red">"rc[-1]",FALSE</font>)</font>)</td></tr></tbody></table></td></tr></table><br />
 
Upvote 0
Maybe

Code:
Public Function CrToNegative(ByVal cr As Range)
If cr.NumberFormat = """""0.00"" Cr""" Then CrToNegative = -cr.Value
End Function

=CrToNegative(A2)

edit:-

Sandeep,

For information A2*-1 could be reduced to -A2.
 
Last edited:
Upvote 0
Yes, John

That's Cool Sandip:beerchug:

And Even Jason UDF is Also Workin

Thanks All of You for Sharing and Giving your Valuable Knowledge and Time

Thanks Again
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

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