<!-- https://learnsql.cpetoday.com/functions/m/record-field -->
# Record.Field

Language: Power Query M
Category: Record
Syntax: Record.Field(record, field)
Summary: Returns the value of one named field in a record.
Returns: The value of the field. An error if the field does not exist.
Level: Beginner
Related: Record.FieldNames, Record.FieldValues, Record.HasFields, Record.TransformFields, Record.SelectFields

## What it does
A record is one row, with named fields. Record.Field reads one of those fields by name. You can also write `row[Amount]`, which does the same thing. Use Record.Field when the field name is held in a variable, such as a name passed in from a parameter or a loop, because you cannot put a variable inside square brackets.

## Syntax and arguments
- `record`: the record to read, such as a single row from a table.
- `field`: the name of the field, as text.

## Example
A function reads the amount from any row, but the column name changes between two bank exports: one calls it "Amount" and the other "Debit".

```powerquery
let
    ColumnName = "Amount",
    Row = [Date = #date(2026, 3, 31), Amount = 1250, Memo = "Rent"],
    Value = Record.Field(Row, ColumnName)
in
    Value
```

`Value` is 1250. Because the name is in a variable, Record.Field is the right tool. If the name were fixed, `Row[Amount]` would be shorter.

## Example: a second, different use
Reading a field inside `each` when the column name comes from a list: `each Record.Field(_, ColumnName)` inside a List.Transform over a list of rows.

## Things to watch
- A missing field is an error. Use `row[Amount]?` for null in its place, or check first with Record.HasFields.
- Field names are case sensitive. "amount" is not "Amount".
- Reading a field gives the value as stored. If it is text, convert it before you add it up.
- Inside a table query, `[Amount]` inside `each` is the usual way to read a column.

## In business terms
Column names change between bank, ERP and card exports more often than people expect. A small function that takes the field name as an argument keeps one query working across those exports.
