Not sure you're looking for a VBA solution, and this can likely be accomplished with some SUMIF's, but I suck at Excel formulas.

To use this code:
  1. Open the VBA editor by pressing Alt+F11 in Excel
  2. In the window that opens, you'll see a project explorer window on the left hand side
  3. Find your spreadsheet, then listed under that, find the sheet you want this to run on (in your example, it would be Sheet1)
  4. Double click that sheet
  5. Paste the code in the white space to the right

Now the code will run automatically any time you enter a number into column G, assuming columns C and F are also filled out for that row.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 7 And Range("F" & Target.Row) <> "" And _
Range("C" & Target.Row) <> "" Then
    Set c = Range("J:J").Find(Target.Offset(0, -4).Value)
    If Not c Is Nothing Then
        If Target.Offset(0, -1) = "In" Then
            c.Offset(0, 1).Value = c.Offset(0, 1).Value + Target.Value
        Else
            c.Offset(0, 1).Value = c.Offset(0, 1).Value - Target.Value
        End If
    End If
End If
End Sub