Is there a way to add some predefined analysis/evaluation cells to an existing spreadsheet?
My use-case is an application that generates an MS Excel file with employee data from a database. We need to evaluate this data in ways that are not possible from within the application, so we add some columns with formulas in Excel.
Is there a good way to save these evaluation cells as a template and apply them to a newly generated file?
Example file/table that is generated from application:
+-------------+
| ColA | ColB |
+-------------+
| foo | baz |
| bar | baz |
| foo | |
| bar | |
+-------------+
With additional formulas that should be added automatically (currently, I use copy/paste to add the formulas from an old file)
+-----------------------------+
| ColA | ColB | Eval1 | Eval2 |
+-----------------------------+
| foo | baz | 1 | 1 |
| bar | baz | 0 | 1 |
| foo | | 1 | 0 |
| bar | | 0 | 0 |
+-----------------------------+
Edit to clarify: I do not want any explicit formula, but a more general way on how to add arbitrary columns with formulas. I'm very new to Excel (and have not touched VBA so far), so I don't know if this is even possible and how much work is involved.
This question is not about any calculation, but more about the process of adding custom predefined formulas to newly generated .xlsx
files. The before and after tables in my example are only to demonstrate where columns should be added, but are not meant to carry any semantic.
For my explicit problem, I always get a file with the columns Month
, Employee
and WorkHours
. Then, the columns with the percentages need to be added, which I usually do by hand and drag them down for all the rows. This is not a complicated task, but I need a way to make it accessible to my coworkers without having them manually copy the formulas from a file somewhere.
+-----------------------------------------------------------+
|Month Employee WorkHours 25% 50% 75% 100% |
|01.2016 PersonA 149,25 FormA FormB FormC FormD|
|01.2016 PersonB 79,00 FormA FormB FormC FormD|
+-----------------------------------------------------------+
Formulas are the following:
FormA: =IF(AND(C2>0;C2<=40);0,25;"")
FormB: =IF(AND(C2>40;C2<=80);0,5;"")
FormC: =IF(AND(C2>80;C2<=120);0,75;"")
FormD: =IF(C2>120;1;"")