Formula or Macros to put Numbers from one column into One

Kazdima

Board Regular
Joined
Oct 15, 2010
Messages
226
There are 2 columns Debit and Credit both with positive sign.
I need to put numbers from Credit into Debit Column with sign "minus".
[TABLE="width: 152"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Debit[/TD]
[TD]Credit[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]1250000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD="align: right"]140[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD="align: right"]140[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD="align: right"]140[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD="align: right"]140[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Sorry, Logit, you were asking abut lines. No, Debit and Credits are on different lines and in different columns.
 
Upvote 0
originally all numbers were formatted in Text format like "0.00".
Does that mean that your data actually looks more like columns A & B below and if you put the formula shown in C2 and copy it across and down, all cells show TRUE?

Excel Workbook
ABCD
1DebitCredit
21250000.000.00TRUETRUE
30.00140.00TRUETRUE
40.00140.00TRUETRUE
5535.000.00TRUETRUE
60.006.00TRUETRUE
70.00634.00TRUETRUE
82000.000.00TRUETRUE
90.00200.00TRUETRUE
One col (4)
 
Last edited:
Upvote 0
Hi Peter,

No, it gives "FALSE". I have checked its format, which I am downloading from accounting system, and it is in "Custom" format. But I can cahnge to any format needed.
 
Upvote 0
OK, so the values are numerical and those blank cells were zero values (perhaps formatted to not display). In that case, try this
Rich (BB code):
Sub MoveCredits_v3()
  With Range("A2:A" & Range("B" & Rows.Count).End(xlUp).Row)
    .Value = Evaluate(Replace(Replace("if(#="""","""",if(#=0,-^,#))", "#", .Address), "^", .Offset(, 1).Address))
    .Offset(, 1).Clear  '<- Optional to clear Credit column
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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