Function Problems

How to Check If a Country and Capital Match in WPS Office Excel

Emma BrownEmma Brown Nov 13, 2026 868 views

Question details

The user wants an Excel formula that looks up a country's capital in a table and returns Correct when the entered value matches or Wrong when it does not.

How to Check If a Country and Capital Match in WPS Office Excel
Product
WPS Office Spreadsheet
Device & OS
not provided
Scenario
The user has a table of countries and capitals and needs to verify an entered country-capital pair against that table.
Observed behavior
The formula should compare the looked-up capital with the entered capital and display Correct or Wrong.
Before you start

Arrange the country list in one column and the capital list in the adjacent column, then identify the cells where you will type the country and capital to check.

Solution 1Recommended

Use VLOOKUP with IF to Check a Country and Capital Match

Use this formula when you already have a country-capital table in WPS Office Spreadsheet and want a single result cell to show Correct or Wrong.

The formula uses VLOOKUP to find the country in the table and return its official capital, then IF compares that value with the entered capital.

1
Select the result cell

Click the cell where you want the check result to appear.

2
Enter the comparison formula

Type =IF(VLOOKUP(D2,$A$2:$B$4,2,FALSE)=E2,"Correct","Wrong") and adjust the ranges and cells to match your sheet.

3
Press Enter

Press Enter to run the formula. WPS Office Spreadsheet displays Correct when the entered capital matches the looked-up capital and Wrong when it does not.

Use VLOOKUP with IF to Check a Country and Capital Match
Formula returns Correct or Wrong: If you see #N/A, confirm that the country in D2 exists in column A and that your table range includes both countries and capitals.
WPS Office Spreadsheet

Check Country and Capital Matches in WPS Office Spreadsheet

Use WPS Office Spreadsheet to create a VLOOKUP and IF formula that compares an entered capital with the official capital for a country and returns Correct or Wrong immediately.

  1. 1. Open WPS Office Spreadsheet: Launch WPS Office and create or open a workbook that contains your country and capital table.
  2. 2. Enter the lookup values: Type the country to check in D2 and the capital to compare in E2, then select the result cell.
  3. 3. Insert the formula: Enter =IF(VLOOKUP(D2,$A$2:$B$4,2,FALSE)=E2,"Correct","Wrong") in the formula bar.
  4. 4. Press Enter: Press Enter to calculate the result and see Correct or Wrong in the selected cell.
Supports familiar Excel lookup formulas such as VLOOKUP and IF for country-capital checksOpens and saves .xlsx and .xls files with full Microsoft Excel compatibilityFree to use, so you can create and edit lookup formulas without a subscriptionLightweight spreadsheet interface makes formula entry and range selection quick
microsoft office alternative - wps office

Frequently Asked Questions

Which formula checks whether a country and capital match in WPS Office Excel?

Use =IF(VLOOKUP(D2,$A$2:$B$4,2,FALSE)=E2,"Correct","Wrong"). D2 is the country to look up, E2 is the capital to compare, and A2:B4 contains the country-capital table.

Why does my formula return #N/A when checking a country and capital?

#N/A usually means the country in D2 was not found in the first column of the VLOOKUP range. Check that the spelled country exists in the table and that the range includes both columns.

Can I extend the formula beyond three rows of countries and capitals?

Yes. Change the lookup range to cover all rows, for example =IF(VLOOKUP(D2,$A$2:$B$100,2,FALSE)=E2,"Correct","Wrong").

Can I use XLOOKUP for the same country-capital check?

Yes. If WPS Office supports it in your version, use =IF(XLOOKUP(D2,$A$2:$A$100,$B$2:$B$100)=E2,"Correct","Wrong").

Does this formula work in WPS Office Spreadsheet?

Yes. WPS Office Spreadsheet supports VLOOKUP and IF formulas, so the same country-capital check works in .xlsx and .xls workbooks.