Using Defined Names in a IF Statement

tycasey17

Board Regular
Joined
Sep 26, 2013
Messages
93
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
A1 = PVT

=IF(A1=_OFF,"Yes","No")

The Defined Name of "_OFF" list officer ranks and PVT would not be one of them so the result should be NO. However, this formula doesn't work it returns a #VALUE! error. I was trying to avoid using a VLOOKUP statement for this to keep my formula a little cleaner because this will be a series of nested IF statements.
 
What is the +0 at the end do.

Yes/No is not that useful as result. And harder to process. You need COUNTIF(S) to count the Yes out come.

MATCH delivers either a number or an #N/A value.

ISNUMBER(MATCH(...)) delivers either TRUE or FALSE.

+0 of

ISNUMBER(MATCH(...))+0

coerces a TRUE into 1 and a FALSE into a 0. (By the way, TRUE = 1 and FALSE = 0, in Excel.)

So, we get a 1 for a hit (instead of Yes) and a 0 for a miss (instead of No). To SUM 1's is easier/handier than applying COUNTIFS.
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Faster, yes, but not quite as fun :)

What makes it more appropriate (besides being faster)?
I do like that MATCH can use wildcards which could be helpful here

MATCH is locating a value, while SUMPRODUCT is counting that value. The former is what is wanted.
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,256
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top