Compare-Object show mathmatical difference

Welcome Forums General PowerShell Q&A Compare-Object show mathmatical difference

Viewing 1 reply thread
  • Author
    • #98154
      Topics: 2
      Replies: 1
      Points: 0
      Rank: Member

      Trying to compare two excel sheets, select out a specific column and then compare the values in each row and return the difference.

      I removed the side indicators cause it was throwing off my format in the post.

      $Diff = import-csv C:\scripts\Testing_diff.csv | Select-Object Name, Volume
      $reff = import-csv C:\scripts\Testing_reff.csv | Select-Object Name, Volume
      Compare-Object $reff $Diff -Property Name, Volume -PassThru -IncludeEqual

      and it just spits back the following, Trying to get it to give me back the difference of the volume data.

      Name                  Volume   SideIndicator
      ----                  ------   -------------
      Development_b_001     1549.50G           
      Production_b_001      11.57T              
      Production_b_002      1600.03G            
      Development_b_001     549.50G            
      Production_b_001      1.57T              
      Production_b_002      600.03G 
    • #98158
      Topics: 5
      Replies: 2367
      Points: 5,981
      Helping Hand
      Rank: Community MVP

      Compare-Object will not calculate for you. It compares objects or object properties and tell if it’s equal or not. If you need to calculate a difference you will have to do it by yourself.

Viewing 1 reply thread
  • The topic ‘Compare-Object show mathmatical difference’ is closed to new replies.