title: Get values on a row based on two or more rows in Excel
body: <p>I have values in DEMAND row and values in the COLLECTION row, now I want BALANCE = DEMAND-COLLECTION, there are two times collection for an entry so according to the occurrence of collection the balance should arise. Can you please let me know the macro code for that.</p>
  
  <p>I have DEMAND values D1:S1 COLLECTION values from D2:S2 and the balance should be there in the next row.</p>
  
  <p>I came to this step after the solution I got from 
  <a href="https://stackoverflow.com/questions/34691318/insert-row-base-on-specific-text-and-its-occurrence">Insert row base on specific text and its occurrence</a></p>
  
  <p>I am using the following code</p>
  
  <pre><code>Sub try()
   Dim c As Range
   Dim lRow As Long
   lRow = 1
   Dim lRowLast As Long
   Dim bFound As Boolean
   With ActiveSheet
    lRowLast = .Cells(.Rows.Count, 1).End(xlUp).Row
    Do
     Set c = .Range("A" &amp; lRow)
     If c.Value Like "*COLLECTION*" Then
      bFound = True
     ElseIf bFound Then
      bFound = False
      If c.Value &lt;&gt; "BALANCE" Then
       c.EntireRow.Insert
       lRowLast = lRowLast + 1
       c.Offset(-1, 0).Value = "BALANCE"
       c.Offset(-1, 0).Font.Color = RGB(0, 0, 0)
      End If
     End If
     lRow = lRow + 1
    Loop While lRow &lt;= lRowLast + 1
   End With
  End Sub
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/VOEPy.jpg" rel="nofollow noreferrer">before macro check IMAGE</a></p>
  
  <p><a href="https://i.stack.imgur.com/r5oaq.jpg" rel="nofollow noreferrer">After Macro I want this check image </a></p>