uniteapps.dk/en/excel-macro-pack-denmark

Excel macro pack – Danish statutory interest (procesrente) and overtime in your spreadsheets

Update your spreadsheets with ready-made VBA functions for Danish statutory interest (procesrente), overtime calculation and rates for free choice accounts (fritvalgskonto) and pension.

Danish rules

This calculator applies Danish law and Danish collective agreements. It is for employment in Denmark and does not reflect the rules of other countries.

Excel Macro Injector
Add VBA macros and calculation sheets from a template to your Excel files

The macros, function names (e.g. =procesrente() and =Overtid()) and help sheets are in Danish and calculate under Danish rules.

Target files (.xlsx)

Click to choose one or more .xlsx files

Max 50 files · 20 MB per file


About the Excel Macro Pack

The Excel Macro Pack copies VBA macros and calculation sheets from the built-in template for Danish statutory interest (procesrente) into your own Excel files. You keep all your existing sheets — the template's calculation functions, lookup tables and macros are added on top. The functions calculate under Danish rules: statutory interest under the Danish Interest Act (renteloven) and overtime under Danish collective agreements (overenskomster). The function names, sheets and help texts in the workbook are in Danish. For a single claim you can use the statutory interest calculator directly in your browser.

What does the pack contain?

Calculation functions

  • =procesrente()
  • =rentedage()
  • =Overtid()
  • =Arbejdstid()

Lookup functions

  • =FritvalgsOpslag()
  • =PensionsOpslag_Arbejdsgiver()
  • =PensionsOpslag_Lønmodtager()
  • =PensionsOpslag()

Macros

  • Create PDF with workings
  • Extend dates (with year markers)
  • Extend pay period
  • Update interest rates from Danmarks Nationalbank

First time: enable macros

Remove the Windows block

When you download an .xlsm file from the internet, Windows marks it as potentially unsafe. You must remove this block before Excel can run the macros.

  1. 1Find the downloaded .xlsm file in Windows File Explorer
  2. 2Right-click the file and choose Properties
  3. 3Open the General tab — look for the "Security" field at the bottom
  4. 4Tick "Unblock" and click OK
  5. 5Now open the file in Excel

The "Unblock" field only appears if Windows has blocked the file. If you don't see it, the file is already approved.

Enable macros in Excel

The first time you open the file, Excel shows a yellow warning bar at the top: "Macros have been disabled."

  1. 1Click the yellow bar at the top of Excel
  2. 2Choose "Enable Content"
  3. 3The macros are now active — the calculation functions work
  4. 4Next time you open the file this happens automatically (if the file is saved locally)

Alternatively: open the VBA editor with Alt+F11 and click Run, or use the ribbon under Developer → Macros.

Calculation functions

All the functions below are user-defined VBA functions that the macro pack adds to your Excel file. You use them like ordinary Excel formulas with =functionname(...). The function and parameter names are Danish and must be typed exactly as shown — Excel does not translate them. Argument separators and built-in functions (TRUE/FALSE, EDATE) follow your own Excel language; the examples below use English Excel with commas.

procesrente

=procesrente(beløb, fra, til, [forældelse], [rentetillæg], [sidstebankdag])

Calculates statutory interest (procesrente) under the rules of the Danish Interest Act (renteloven), using the European 30/360 day count. The interest rates are taken automatically from the 'renter' sheet (interest rates), which is updated from Danmarks Nationalbank. Handles limitation, the margin and banking-day rules.

Parameters

beløbAmount: the sum that bears interest (in DKK)
fraFrom: the date from which interest starts to run
tilTo: the date up to which interest is calculated (exclusive)
forældelse (optional)Limitation date — no interest is calculated before this date. Enter 0 or leave the cell empty to start from the 'fra' date
rentetillæg (optional)Margin on top of the reference rate. Numbers of 1 or more are percentage points (8 = 8%, 1 = 1%); numbers below 1 are decimals (8% = 0.08 = 8%). Default: 0
sidstebankdag (optional)TRUE: interest runs from the day after the month's last banking day (e.g. 01-06-2024 → last banking day 28-06-2024 → interest from 29-06-2024). FALSE or omitted: the date is used as it is

Example

=procesrente(1000, A4, A5, A6, 8, TRUE)

Result: Statutory interest calculated incl. the 8% margin, with the banking-day shift

The function requires the 'renter' sheet to exist in the workbook. The interest rates are fetched automatically from Danmarks Nationalbank — see the section on automatic updating.

rentedage

=rentedage(fra, til, [forældelsesdato], [sidstebankdag])

Calculates the number of interest days (30/360, European) in exactly the period on which procesrente charges interest with the same dates: from the start of interest (the 'fra' date, or the day after the last banking day if chosen, but no earlier than the limitation date) up to 'til'.

Parameters

fraFrom: the date from which interest runs, e.g. the month in which the pay fell due. An empty cell returns an empty cell
tilTo: the date up to which interest is calculated
forældelsesdato (optional)Limitation date: days before this date are not counted. Must be a date (not a number of months) — use e.g. EDATE(til, -36) for the 3-year limitation period for interest
sidstebankdag (optional)TRUE: count from the day after the month's last banking day — like procesrente with TRUE. FALSE or omitted: from the 'fra' date

Example

=rentedage(B4, B5, B6, B8) — where B4=28-02-2019, B5=01-01-2025, B6=EDATE(B5, -36), B8=TRUE

Result: 1080 (01-01-2022 → 01-01-2025; the days before the limitation date are not counted)

Give the same dates and the same sidstebankdag as in the procesrente formula, so the days match the interest calculation. If all 'fra' dates fall before the limitation date, the function returns 3 × 360 = 1080 days — that is the limitation of interest (renteforældelse). An explanation of each argument is shown in Excel's Function Arguments dialog (fx).

Overtid

=Overtid(timenorm, arbejdstid, oprunding)

Calculates the overtime pay for one day in hours (overtime hours including the premium). The premium is calculated band by band from the named range 'tabel_overtid': each rate applies only to the hours in its band. The default table follows, for example, the Danish Industry Salaried Employees' Agreement (Industriens Funktionæroverenskomst) § 11(3) and the Salaried Employees' Agreement for Commerce, Knowledge and Service (Funktionæroverenskomsten for Handel, Viden og Service) § 3, no. 1: 50% for the first 3 hours, then 100%.

Parameters

timenormStandard hours: the normal working time as a decimal (e.g. 37 or 37.5)
arbejdstidWorking time: the hours actually worked, as a decimal
oprundingRounding: the time unit to round up to — e.g. 0.5 for half hours

Example

=Overtid(8, 12, 0.5)

Result: 6.5 — 4 overtime hours: 3 × 1.5 + 1 × 2.0

Requires a named range 'tabel_overtid' with two columns: Fra timer (from hours) and Sats (rate), e.g. 0 | 0.50 and 3 | 1.00. The thresholds must be ascending; empty rows are skipped, and hours below the lowest threshold get no premium. The function does not know the time of day or the weekday — overtime on Sundays and public holidays (helligdage) (and, under the Commerce, Knowledge and Service agreement, between midnight and 06:00) is paid at 100% from the first hour and must be calculated separately.

Arbejdstid

=Arbejdstid(fra, til)

Calculates working time in hours as a decimal — also when the shift crosses midnight. Useful for calculating hours for night shifts and shift work.

Parameters

fraFrom: start time as a clock time (e.g. 22:00)
tilTo: end time as a clock time (e.g. 02:00)

Example

=Arbejdstid(C34, D34) — where C34=22:00, D34=02:00

Result: 4 (4 hours of work across midnight)

Lookup functions

The lookup functions look up rates in the Procentsatser sheet (percentage rates) based on a date. You can edit the rates directly in that sheet so they match your collective agreement (overenskomst). The functions always return the rate that applies on the given date.

FritvalgsOpslag
=FritvalgsOpslag(dato)

Looks up the free choice account (fritvalgskonto) rate for the given date. The rates are maintained in the Procentsatser sheet.

=FritvalgsOpslag(01-05-2023)

Result: 7.00%

PensionsOpslag_Arbejdsgiver
=PensionsOpslag_Arbejdsgiver(dato)

Returns the employer's pension contribution for the given date.

=PensionsOpslag_Arbejdsgiver(01-05-2023)

Result: 8.00%

PensionsOpslag_Lønmodtager
=PensionsOpslag_Lønmodtager(dato)

Returns the employee's pension contribution for the given date.

=PensionsOpslag_Lønmodtager(01-05-2023)

Result: 4.00%

PensionsOpslag
=PensionsOpslag(dato)

Returns the total pension contribution (employer + employee) for the given date.

=PensionsOpslag(01-05-2023)

Result: 12.00% (8% + 4%)

The rates are stored in the Procentsatser sheet. Edit them directly in the sheet so they match your collective agreement and company. The functions automatically find the correct rate based on the date you enter (dato = date).

Macros

You run the macros via Alt+F8 (the Macro dialog) or via buttons in the sheet. You can also open the VBA editor with Alt+F11 and run them directly. The macros' dialogs and messages are in Danish.

Create PDF / sheet with workingsAlt+F8 → ProcesrentePDF

Finds all =procesrente() formulas on the active sheet, calculates the interest period by period and exports a detailed report as a PDF file with one line per interest period.

  1. 1Open the sheet with your procesrente formulas
  2. 2Run the macro via Alt+F8 → ProcesrentePDF → Run
  3. 3The macro creates the sheet 'Procesrente_Rapport' with details for each interest period
  4. 4The PDF is saved automatically in the same folder as the Excel file
  5. 5A dialog box shows the full path to the saved PDF
Extend dates (with year markers)Alt+F8 → UdvidDatoerStabilt_MedFormatering

Extends a date-based table by adding months before and/or after the existing data range. Automatically marks each new year with double row height and a bold year.

  1. 1Place the cursor in the sheet with the date column (column A)
  2. 2Run the macro — a dialog box opens
  3. 3Enter: months before, months after and the start row number
  4. 4The macro copies formats and formulas to the new rows
  5. 5New calendar years are highlighted automatically in bold with extra row height
Extend pay periodAlt+F8 → UdvidLønperiode

Same principle as Extend dates, but aimed at pay period statements. Keeps the formulas and formatting from the first/last existing row and copies them to the new periods.

  1. 1Open the pay period sheet
  2. 2Run the macro via Alt+F8 → UdvidLønperiode → Run
  3. 3Enter months before, months after and the start row number in the dialog
  4. 4Existing data and formulas are kept unchanged
  5. 5New rows get the same formulas as the first and last existing row respectively
Update interest ratesAlt+F8 → UpdateInterestRates

Fetches the latest official statutory interest rates directly from Danmarks Nationalbank and updates the 'renter' sheet. Requires an internet connection. Typically used on 1 January and 1 July, when Danmarks Nationalbank publishes new rates.

  1. 1Make sure the Excel file is saved locally (not on OneDrive while syncing)
  2. 2Run the macro via Alt+F8 → UpdateInterestRates → Run
  3. 3The macro fetches XML data from nationalbanken.dk
  4. 4The 'renter' sheet is updated automatically with the latest rates, sorted by date
  5. 5A confirmation dialog shows whether the sheet was created or updated

Automatic updating of interest rates

The Danish statutory interest rate (procesrente) normally changes twice a year — on 1 January and 1 July. The macro pack automatically fetches the current rates directly from Danmarks Nationalbank's public XML feed.

The function OpdaterRenterHvisGammel() is called automatically when the workbook is opened, via Workbook_Open. It checks whether the interest sheet has already been updated in the current half-year — if so, nothing happens. If it is out of date, new rates are fetched automatically.

You can also update manually at any time via Alt+F8 → UpdateInterestRates.

The 'renter' sheet

The sheet is created automatically if it does not exist. It contains:

Column A

Date (1 Jan / 1 Jul)

Column B

Interest rate (decimal, e.g. 0.0375)

The table only shows historical and current rates — future dates are not included. The time of the latest update is stored in cell D1.

The data source is Danmarks Nationalbank's official XML endpoint: nationalbanken.dk/interestrates with type code UDL (the lending rate (udlånsrente) used for statutory interest).

The two modes

Built-in template

Uses the fixed statutory interest template. No extra upload needed — just choose your target files and click "Add macros".

Upload your own source

Upload any .xlsm file as the source. Macros and sheets from your source file are copied into the selected target files.

Output and file names

Single file: downloaded directly as filename_macro-pack.xlsm.

Batch: all files are packed into macro-pack_files.zip. Files that could not be processed are listed in ERRORS.txt inside the zip file.

Your original .xlsx files are not affected.