# n8n If Node Number Comparisons: Totals, Scores, Wrong Type

> Compare numbers in the n8n If node, type value2 without $ or commas, and fix "Wrong type: is a string but was expecting a number".

Source: https://learn.ynteractive.com/content/blog/n8n-if-node-number-comparison · Updated 2026-10-20 · Free from Stepthrough (https://learn.ynteractive.com)

Quick answer

To compare numbers in an [n8n If node](https://learn.ynteractive.com/content/glossary/if-node), put the number in **value1**, open the comparison and choose an operator under **Number**, such as **is greater than**, then type a plain number in **value2**: `1000`, not `$1,000`. If n8n says "Wrong type: ... is a string but was expecting a number", the value arrived as text; fix the source or turn on type conversion. The free [invoice approval lesson](https://learn.ynteractive.com/content/invoice-inbox-to-google-sheets-approval-n8n) routes [invoices](https://learn.ynteractive.com/content/glossary/invoice) over $1,000 this way.

Last updated October 20, 2026

[Take the free module →](https://learn.ynteractive.com/courses/ai-for-accounting-firms/13)Module 13 of the free [AI for Accounting & Bookkeeping Firms](https://learn.ynteractive.com/courses/ai-for-accounting-firms) course, about 14 minutes. No account needed.

By [Robert Breen](https://learn.ynteractive.com/content/about) · Published October 20, 2026 · Updated October 20, 2026 · 3 min read

n8n · If node · Troubleshooting

## How do I check if a total is over $1,000?

1. Add an **If** node after the step that has the total.
2. In **value1**, paste `{{ $('Information Extractor').item.json.output.total }}`.
3. Open the comparison (it says **is equal to**) and under **Number** choose **is greater than**.
4. In **value2**, type `1000`. No dollar sign, no comma.

Items above 1000 go to the **true** output, the rest to **false**. In the lesson only the [true branch](https://learn.ynteractive.com/content/glossary/true-and-false-branches) has a next step: the approval email. The glossary explains [true and false branches](https://learn.ynteractive.com/content/glossary/true-and-false-branches).

## How do I check a lead score?

The [speed-to-lead lesson](https://learn.ynteractive.com/content/speed-to-lead-agent-n8n) does the same with a 1-10 score: value1 `{{ $('Information Extractor').item.json.output.score }}`, operator **Number: is greater than or equal to**, value2 `8`. Hot leads go down the true branch to a Slack alert.

## Which number operators are there?

| Operator | True when value1 is... | Example |
| --- | --- | --- |
| is equal to | the same number | quantity = 0 |
| is not equal to | any other number | status code is not 200 |
| is greater than | larger | total > 1000 |
| is less than | smaller | score < 5 |
| is greater than or equal to | larger or the same | score >= 8 |
| is less than or equal to | smaller or the same | days left <= 3 |
| exists / does not exist | present or missing | a total was found at all |

## "Wrong type: '1,240.00' is a string but was expecting a number"

The If node got text, not a number. Common causes: a sheet column formatted as currency, an AI answer with a $ sign, or a webhook that sends every value as text.

Fixes, best first:

1. **Get a real number at the source.** The invoice lesson's extractor prompt asks for "the final amount due, as a number with no $ sign", and its JSON example uses `250.75`, not `"$250.75"`.
2. **Convert in the expression:** `{{ Number($json.Total.replace(/[$,]/g, '')) }}`.
3. **Let the If node convert:** turn on its option to convert types where required (loose type validation).

## Why does "is greater than" give the wrong answer?

If both values are treated as text, "999" is "greater" than "1000" because 9 comes after 1. Make sure you picked the operator under **Number**, not **String**.

## Try it free, step by step

**Invoices from Your Inbox to Google Sheets, with Approval**. Build an n8n workflow that reads each vendor invoice PDF from Gmail with AI, logs the vendor, invoice number and total in Google Sheets, and emails the owner an Approve button for anything over… You do every step yourself in a practice copy of n8n, it checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, and nothing touches your real accounts.

[Start the free lesson](https://learn.ynteractive.com/modules/invoice-inbox-approval)

[Or read the full step-by-step guide](https://learn.ynteractive.com/content/invoice-inbox-to-google-sheets-approval-n8n)

## Should I use If, Filter or Switch?

- **If:** two paths, both may continue (approval vs log only).
- **Filter:** keep only matches, drop the rest.
- **Switch:** three or more paths, such as amount bands. n8n If vs Switch compares them.

## Key takeaways

- Choose the operator under Number, and type value2 as a plain number.
- Map the number from the node that made it, often the Information Extractor.
- "Wrong type ... is a string" means text arrived; fix the source or convert.
- Ask AI extractors for numbers without $ signs or commas.

## Frequently asked questions

**How do I compare numbers in n8n?**

Use an If or Filter node, choose a Number operator such as is greater than, and enter a plain number as value2.

**Why does my n8n If node say wrong type?**

The value is a string, not a number. Convert it with Number() in the expression, or turn on the If node's type conversion option.

**Can I compare against a value from another node?**

Yes. value2 can be an expression too, like a limit stored in a settings sheet.

**Which course is this from?**

[AI for Finance Teams](https://learn.ynteractive.com/courses/ai-for-finance) and [AI for Sales Teams](https://learn.ynteractive.com/courses/ai-for-sales). Also see the [If node](https://learn.ynteractive.com/content/glossary/if-node) glossary entry.

## Free lessons in this post

- [Invoices from Your Inbox to Google Sheets, with Approval](https://learn.ynteractive.com/content/invoice-inbox-to-google-sheets-approval-n8n): Build an n8n workflow that reads each vendor invoice PDF from Gmail with AI, logs the vendor, invoice number and total in Google Sheets, and emails the owner an Approve…
- [Speed-to-Lead Agent: Answer Every Web Lead in 60 Seconds](https://learn.ynteractive.com/content/speed-to-lead-agent-n8n): Build an n8n workflow that scores every website lead with AI, emails a personal first reply within seconds, and pings Slack only when a lead is hot.

## Watch it in a free lesson: IF and Switch in n8n: Route Work by Rules

### IF and Switch: Route Work by Rules: video walkthrough

Full walkthrough · 3:11 · with captions

Send each request where it belongs. Use an If node to split big jobs from small ones, then a Switch with named outputs and a fallback to route by service. The whole lesson narrated step by step, recorded in Stepthrough’s simulated practice environment.

[Watch it with chapters and the full transcript](https://learn.ynteractive.com/content/n8n-if-and-switch-node-tutorial#watch)

From the free lesson [IF and Switch in n8n: Route Work by Rules](https://learn.ynteractive.com/content/n8n-if-and-switch-node-tutorial)

## Related terms

Plain-English definitions, each with an example from a free lesson.

[IF node](https://learn.ynteractive.com/content/glossary/if-node) · [Invoice](https://learn.ynteractive.com/content/glossary/invoice) · [True and false branches](https://learn.ynteractive.com/content/glossary/true-and-false-branches) · [AI data entry](https://learn.ynteractive.com/content/glossary/ai-data-entry) · [AP aging report](https://learn.ynteractive.com/content/glossary/ap-aging-report) · [Apollo.io](https://learn.ynteractive.com/content/glossary/apollo-io) · [Approval threshold](https://learn.ynteractive.com/content/glossary/approval-threshold) · [ETL (extract, transform, load)](https://learn.ynteractive.com/content/glossary/etl)

[The full AI glossary](https://learn.ynteractive.com/content/glossary)

## Related prompts

- [Invoice approval request email prompt](https://learn.ynteractive.com/content/prompts/invoice-approval-request-email-prompt): A copy-ready prompt that writes a clear approval request for a large invoice, so the owner can say yes or no in one reply with…

[All free prompt templates](https://learn.ynteractive.com/content/prompts)

## Keep reading

- [n8n OpenAI JSON Output: Get Data Back, Not a Paragraph](https://learn.ynteractive.com/content/blog/n8n-openai-json-output): Make the n8n OpenAI node return usable JSON: the exact shape in the prompt, Output Format set to JSON Object, the output path and when to use Extractor.
- [n8n Gmail Node Examples: Send, Draft, Wait for Approval](https://learn.ynteractive.com/content/blog/n8n-gmail-node-examples): Five n8n Gmail node setups from real workflows: send a message, create a draft, send and wait for approval, email type and the n8n footer.
- [n8n $('Node').item.json: Use Data from an Earlier Node](https://learn.ynteractive.com/content/blog/n8n-reference-previous-node): How $('Node name').item.json reaches back to an earlier node in n8n, when $json isn't enough, and examples from Gmail, If and Slack steps.

[All blog posts](https://learn.ynteractive.com/content/blog) · [All free tutorials](https://learn.ynteractive.com/content)
