Forum Discussion
azmxmlk
Mar 29, 2022Copper Contributor
IF and VLOOKUP
Hi, I am working on a project where I am trying to populate a value from a table (that is being queried into the workbook from an external source). Ex: If I type in the State value as 'NY' - I nee...
HansVogelaar
Mar 29, 2022MVP
Let's say that the state abbreviations are in B2:B52 on the PR sheet and the corresponding Power $/kWh in E2:E52.
The formula in B23 could be
=IFERROR(VLOOKUP(B22,PR!$B$2:$D$52,3,FALSE),"")
(3 is the 3rd column of B2:D52)
or, if you have Microsoft 365 or Office 2021:
=XLOOKUP(B2,PR!$B$2:$B$52,PR!$D$2:$D$52,"")
azmxmlk
Mar 29, 2022Copper Contributor
So the state abbs are in B2:B52 - what's D52 doing here - I m confused - was it a typo?
- HansVogelaarMar 29, 2022MVP
Yes, sorry, a typo.
"and the corresponding Power $/kWh in E2:E52." should have been "and the corresponding Power $/kWh in D2:D52.