只有符号的两列之间的差异

时间:2015-09-14 04:00:15

标签: excel

我有两列,想要计算Excel中两列(即B1-A1)之间的差异。但是我只想说明第三栏中的差异是正面还是负面。

我在Excel中的数据样本如下所示:

$path = "H:\Compare\Extracted"
$Text = "abc Software"
$Text2 = "def Software"
$Results = "H:\Compare\Results\$($file.name).txt"
$files = Get-ChildItem $path -recurse -Include *.txt

foreach ($file in $files) {
    Get-Content $file |
       Select-String -Pattern $Text, $Text2 |
       select line |
       Out-File $Results -Append
}

这里我想用公式计算两列之间的差异 C1 =(B1-A1)

但我只想表明符号如下所示:

8438    8510
3709    3181

请指教?

2 个答案:

答案 0 :(得分:0)

我认为您应该使用数字格式。

通过单击列标题选择所有列C.

右键单击并选择 public class DrinkWater extends ActionBarActivity { Toolbar toolbar; private RecyclerView recyclerView; private InfoTodayAdapter adapter; FileOutputStream fos; FileInputStream fis; List<InformationToday> data = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_drink_water); toolbar = (Toolbar) findViewById(R.id.app_bar); setSupportActionBar(toolbar); recyclerView = (RecyclerView) findViewById(R.id.recyclerview_today); adapter = new InfoTodayAdapter(this,getData()); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); } public List<InformationToday> getData(){ try { fis = getBaseContext().openFileInput("arrayListToday"); ObjectInputStream ois = new ObjectInputStream(fis); //Below Toast just for debugging. Toast.makeText(this,"Try block for read data called 1",Toast.LENGTH_SHORT).show(); data = (List<InformationToday>) ois.readObject(); // Cause of the error. //Below toast for debugging. But it is never executed. Toast.makeText(this,"Try block for read data called 2",Toast.LENGTH_SHORT).show(); ois.close(); } catch (FileNotFoundException e) { e.printStackTrace(); Log.d("TAG A","arrayListToday file not found"); } catch (Exception e){ Log.d("TAG A","Exception generated 1"); } return data; } public void addWater(View view) { // This method adds data to the recyclerView. It is called by on click of the Floating Action Button InformationToday i = new InformationToday(); if(view.getId() == R.id.fifty_button) { i.volume = "50"; Log.d("TAG A","i.volume = 50"); } else { i.volume = "100"; } data.add(0,i); adapter.update(data); //This method is described in recyclerView adapter. It updates the recyclerView data. try { fos = getBaseContext().openFileOutput("arrayListToday",Context.MODE_PRIVATE); ObjectOutputStream oos = new ObjectOutputStream(fos); Toast.makeText(this,"Try block for wrtie data called 1",Toast.LENGTH_SHORT).show(); //For debugging. oos.writeObject(data); // Cause of the error. Toast.makeText(this,"Try block for write data called 2",Toast.LENGTH_SHORT).show(); //For debugging. It is never executed. oos.close(); } catch (FileNotFoundException e) { Toast.makeText(this,"Catch: File not gound exception",Toast.LENGTH_SHORT).show(); Log.d("TAG A", "Catch: File not found"); e.printStackTrace(); }catch (Exception e){ Toast.makeText(this,"Catch: Exception e",Toast.LENGTH_SHORT).show(); Log.d("TAG A","Catch: Exception e"); } com.getbase.floatingactionbutton.FloatingActionsMenu f = (FloatingActionsMenu) findViewById(R.id.multiple_actions); f.collapseImmediately(); } }

点击Format cells...标签,然后从左侧列表中选择Number

Custom字段中输入:Type:

单击“确定”。

那就是它。现在,当您在C列中使用您的公式时,数字答案将完全显示您已设想的。

答案 1 :(得分:0)

您需要使用 cl -c -nologo -WX -W3 -Oax2 -I C:\Program Files (x86)\Microsoft Visual S tudio 14.0\VC\include -I C:\Users\..\Desktop\School\GERBIL02\src -I C:\Users\..\Desktop\School\GERBIL02\src\engine -Zi C:\Users\..\Desktop\School\GERBIL02 \src\engine\engine.c /FoC:\Users\..\Desktop\School\GERBIL02\ship\engine 'cl' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: 'cl' : return code '0x1' Stop. 功能,它需要三个参数:

IF()

所以你的例子是:

=IF([condition], [result if true], [result if false])