BITRSHIFT Function (LibreOffice Calc)

Mathematical Beginner LibreOffice Calc Introduced in LibreOffice 4.0
math bitwise binary shifting number-systems encoding

The BITRSHIFT function performs a bitwise right shift on a non‑negative integer. It is used for binary manipulation, fast division by powers of two, and low‑level numeric processing.

Compatibility

What the BITRSHIFT Function Does

  • Shifts bits right by a specified number of positions
  • Equivalent to integer division by 2ⁿ
  • Useful for binary decoding, field extraction, and low‑level numeric workflows

Syntax

BITRSHIFT(number; shift)

Arguments

  • number:
    A non‑negative integer.

  • shift:
    Number of bits to shift right (integer; can be negative).

Basic Examples

Shift right by 1 bit (divide by 2)

=BITRSHIFT(10; 1)
→ 5

Because 10 = 1010₂ → 101₂ = 5

Shift right by 3 bits (divide by 8)

=BITRSHIFT(56; 3)
→ 7

Using cell references

=BITRSHIFT(A1; B1)

Advanced Examples

Convert result to binary

=DEC2BIN(BITRSHIFT(A1; 2); 10)

Use negative shift (equivalent to left shift)

=BITRSHIFT(4; -2)
→ 16

Extract a field from a packed integer

=BITAND(BITRSHIFT(A1; 8); 255)

Remove lower bits

=BITRSHIFT(A1; 4)

Use with BASE for arbitrary‑width binary

=BASE(BITRSHIFT(A1; A2); 2; 16)

Right shift with mask combination

=BITAND(BITRSHIFT(A1; 3); 7)

Edge Cases and Behavior Details

BITRSHIFT returns a non‑negative integer

Accepts:

  • Integers ≥ 0
  • Shift values can be positive or negative

Behavior details

  • Positive shift → right shift
  • Negative shift → left shift
  • Fractional inputs are truncated
  • Bits shifted out on the right are discarded
  • Negative numbers are not allowed

Invalid input → Err:502

BITRSHIFT of an error → error propagates

Common Errors and Fixes

Err:502 — Invalid argument

Cause:

  • Negative number
  • Non-integer inputs
  • Non-numeric values

Fix:

  • Wrap with INT()
  • Ensure number ≥ 0
  • Validate numeric input

Unexpected zero result

Cause:

  • Shift too large (all bits shifted out)

Fix:

  • Reduce shift value
  • Inspect binary using DEC2BIN

Best Practices

  • Use BITRSHIFT for fast integer division by powers of two
  • Use negative shift values for left shifts
  • Combine with BITAND for field extraction
  • Use DEC2BIN or BASE for debugging binary states
  • Validate inputs to avoid Err:502
BITRSHIFT is perfect for binary decoding, field extraction, and efficient arithmetic — a core tool for low‑level numeric workflows.

Related Patterns and Alternatives

  • Use BITLSHIFT for left shifts
  • Use BITAND, BITOR, BITXOR for bitwise logic
  • Use DEC2BIN and BIN2DEC for conversions
  • Use BASE for arbitrary‑length binary workflows

By mastering BITRSHIFT and its companion functions, you can build powerful bitwise and binary‑processing workflows in LibreOffice Calc.

Copyright 2026. All rights reserved.