How to Check If a Country and Capital Match in WPS Office Excel
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.

- 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.
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.
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.
Click the cell where you want the check result to appear.
Type =IF(VLOOKUP(D2,$A$2:$B$4,2,FALSE)=E2,"Correct","Wrong") and adjust the ranges and cells to match your sheet.
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.

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. Open WPS Office Spreadsheet: Launch WPS Office and create or open a workbook that contains your country and capital table.
- 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. Insert the formula: Enter =IF(VLOOKUP(D2,$A$2:$B$4,2,FALSE)=E2,"Correct","Wrong") in the formula bar.
- 4. Press Enter: Press Enter to calculate the result and see Correct or Wrong in the selected cell.

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.




