---
title: "Compare two cells with IF in Google Sheets | PracticeExcel"
description: "In D2, show \"Over budget\" if the amount spent in C2 is more than the budget in B2, and \"OK\" if not."
canonical_url: "https://practiceexcelonline.com/sheets/practice/if/if-compare-two-cells"
locale: en
meta:
  "og:description": "In D2, show \"Over budget\" if the amount spent in C2 is more than the budget in B2, and \"OK\" if not."
  "og:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_Compare%2Btwo%2Bcells%2Bwith%2BIF%2Bin%2BGoogle%2BSheets%2Cdescription_~SW4gRDIsIHNob3cgIk92ZXIgYnVkZ2V0IiBpZiB0aGUgYW1vdW50IHNwZW50IGluIEMyIGlzIG1vcmUgdGhhbiB0aGUgYnVkZ2V0IGluIEIyLCBhbmQgIk9LIiBpZiBub3Qu%2Ceyebrow_IF%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiLCJDIiwiRCJdLCJyb3dzIjpbeyJuIjoxLCJjZWxscyI6WyJEZXBhcnRtZW50IiwiQnVkZ2V0IiwiU3BlbnQiLCJTdGF0dXMiXX0seyJuIjoyLCJjZWxscyI6WyJNYXJrZXRpbmciLCI1MDAwMCIsIjU0MjAwIiwiIl19LHsibiI6MywiY2VsbHMiOlsiU2FsZXMiLCI4MDAwMCIsIjc2NTAwIiwiIl19LHsibiI6NCwiY2VsbHMiOlsiSVQiLCIxMjAwMDAiLCIxMTgzMDAiLCIiXX0seyJuIjo1LCJjZWxscyI6WyJIUiIsIjMwMDAwIiwiMzE5MDAiLCIiXX1dLCJ0YXJnZXQiOlsxLDNdfX0%2Cp_Ii9zaGVldHMvcHJhY3RpY2UvaWYvaWYtY29tcGFyZS10d28tY2VsbHMi%2Cs_q5bgf8dy0ZdreKtP.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Compare two cells with IF in Google Sheets | PracticeExcel"
  "twitter:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_Compare%2Btwo%2Bcells%2Bwith%2BIF%2Bin%2BGoogle%2BSheets%2Cdescription_~SW4gRDIsIHNob3cgIk92ZXIgYnVkZ2V0IiBpZiB0aGUgYW1vdW50IHNwZW50IGluIEMyIGlzIG1vcmUgdGhhbiB0aGUgYnVkZ2V0IGluIEIyLCBhbmQgIk9LIiBpZiBub3Qu%2Ceyebrow_IF%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiLCJDIiwiRCJdLCJyb3dzIjpbeyJuIjoxLCJjZWxscyI6WyJEZXBhcnRtZW50IiwiQnVkZ2V0IiwiU3BlbnQiLCJTdGF0dXMiXX0seyJuIjoyLCJjZWxscyI6WyJNYXJrZXRpbmciLCI1MDAwMCIsIjU0MjAwIiwiIl19LHsibiI6MywiY2VsbHMiOlsiU2FsZXMiLCI4MDAwMCIsIjc2NTAwIiwiIl19LHsibiI6NCwiY2VsbHMiOlsiSVQiLCIxMjAwMDAiLCIxMTgzMDAiLCIiXX0seyJuIjo1LCJjZWxscyI6WyJIUiIsIjMwMDAwIiwiMzE5MDAiLCIiXX1dLCJ0YXJnZXQiOlsxLDNdfX0%2Cp_Ii9zaGVldHMvcHJhY3RpY2UvaWYvaWYtY29tcGFyZS10d28tY2VsbHMi%2Cs_q5bgf8dy0ZdreKtP.png"
---

> Index of every page on this site: [llms.txt](https://practiceexcelonline.com/llms.txt)

# **Compare two cells with IF**

**Premium**

In D2, show "Over budget" if the amount spent in C2 is more than the budget in B2, and "OK" if not.

D2fx

|  | A | B | C | D | E | F |
| --- | --- | --- | --- | --- | --- | --- |
| 1 | Department | Budget | Spent | Status |  | |
| 2 | Marketing | 50000 | 54200 |  |  | |
| 3 | Sales | 80000 | 76500 |  |  | |
| 4 | IT | 120000 | 118300 |  |  | |
| 5 | HR | 30000 | 31900 |  |  | |
| 6 |  |  |  |  |  | |
| 7 |  |  |  |  |  | |
| 8 |  |  |  |  |  | |

**Premium lesson**

## **Unlock IF and every other lesson**

This is a premium lesson. Premium lets you solve it and every other lesson, take the timed mock tests, and earn certificates you can share on LinkedIn.

Next with premium:**COUNTIF****SUMIF**

[**See plans, from $5/month**](https://practiceexcelonline.com/pricing) [**Already premium? Sign in**](https://practiceexcelonline.com/login?next=/sheets/practice/if/if-compare-two-cells)

Need help?

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://practiceexcelonline.com/#identity","@type":"Organization","name":"PracticeExcel","url":"https://practiceexcelonline.com/","logo":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/#website","@type":"WebSite","inLanguage":"en-US","name":"PracticeExcel","url":"https://practiceexcelonline.com/","alternateName":["Practice Excel Online","PracticeExcelOnline.com"],"publisher":{"@id":"https://practiceexcelonline.com/#identity"},"workTranslation":{"@id":"https://excelopgaver.dk/#website"}},{"@id":"https://practiceexcelonline.com/sheets/practice/if/if-compare-two-cells#webpage","@type":"WebPage","description":"In D2, show \"Over budget\" if the amount spent in C2 is more than the budget in B2, and \"OK\" if not.","name":"Compare two cells with IF in Google Sheets","url":"https://practiceexcelonline.com/sheets/practice/if/if-compare-two-cells","breadcrumb":{"@id":"https://practiceexcelonline.com/sheets/practice/if/if-compare-two-cells#breadcrumb"},"isPartOf":{"@id":"https://practiceexcelonline.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://practiceexcelonline.com/sheets/practice/if/if-compare-two-cells"]}],"primaryImageOfPage":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/sheets/practice/if/if-compare-two-cells#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://practiceexcelonline.com","position":1},{"@type":"ListItem","name":"Google Sheets practice exercises","item":"https://practiceexcelonline.com/sheets","position":2},{"@type":"ListItem","name":"IF","item":"https://practiceexcelonline.com/sheets/practice/if","position":3},{"@type":"ListItem","name":"Compare two cells with IF in Google Sheets","position":4}]},{"@id":"https://practiceexcelonline.com/sheets/practice/if/if-compare-two-cells#/schema/learning-resource/1","@type":"LearningResource","description":"In D2, show \"Over budget\" if the amount spent in C2 is more than the budget in B2, and \"OK\" if not.","educationalLevel":"beginner","isAccessibleForFree":false,"learningResourceType":"exercise","name":"Compare two cells with IF","teaches":"IF"},{"@id":"https://practiceexcelonline.com/#logo","@type":"ImageObject","caption":"PracticeExcel","contentUrl":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png"}]}
```

## Sitemap

See the full [sitemap](https://practiceexcelonline.com/sitemap.md) for all pages.
