Cost balance Macro in order to find missing items

sheipineapple29

New Member
Joined
Jun 1, 2015
Messages
2
Hi all,

I want to know if you can help me out. The data I have is below:

ABCDE
100020265-7,671,860.087,671,860.08472023645
100020371-6,302,466.477,671,860.08472023731
100020370-2,972,991.071,838,071.62472021113
6200080166-1,838,071.62

<tbody>
</tbody>


I would like to find a macro that can do the next steps:

1. On the side of "A:B", on "C", SUM between "B" and "D"
- If "0", text "ok"
- If different to "0", add rows until the math SUM is "0"

2.On the side of "D:E", on "C" SUM between "B" and "D"
- If "0", text "ok"
- If different to "0", add rows until the math SUM is "0"

3. If not "0", show the total of the SUM.

Example:

ABCDE
100020265-7,671,860.08ok7,671,860.08472023645
100020371-6,302,466.47-6,302,466.47
7,671,860.087,671,860.08472023731
100020370-2,972,991.07-2,972,991.07
6200080166-1,838,071.62ok1,838,071.62472021113

<tbody>
</tbody>



I have to do this with about 25000+ rows. The purpose is to find which ones do not have a match.

Hope you can understand what I am trying to request.

Thank you all.

Sheila
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello,

this seems to work for the posted data. Don't know how long the code will take.

Code:
Sub SUMMING()
    Application.ScreenUpdating = False
    MY_ROWS = 1
    MY_LAST_ROW = Range("A" & Rows.Count).End(xlUp).Row
    Do Until MY_ROWS = MY_LAST_ROW - 1
        If Range("B" & MY_ROWS).Value + Range("D" & MY_ROWS).Value = 0 Then
            Range("C" & MY_ROWS).Value = "OK"
        Else
            If Not IsEmpty(Range("B" & MY_ROWS).Value) Then
                    If Not IsEmpty(Range("D" & MY_ROWS - 1).Value) Then
                        Range("D" & MY_ROWS & ":E" & MY_ROWS).Insert
                        MY_LAST_ROW = MY_LAST_ROW + 1
                    End If
                If Not IsEmpty(Range("D" & MY_ROWS).Value) Then
                    Range("A" & MY_ROWS & ":B" & MY_ROWS).Insert
                    MY_LAST_ROW = MY_LAST_ROW + 1
                End If
            End If
            Range("C" & MY_ROWS).Value = Range("B" & MY_ROWS).Value + Range("D" & MY_ROWS).Value
        End If
        MY_ROWS = MY_ROWS + 1
    Loop
    Application.ScreenUpdating = True
End Sub

Does this work for the rest of your data?
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,058
Latest member
oculus

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