Forum Discussion
Mette820
Nov 08, 2019Copper Contributor
If or ifs and search function
Hi, I am trying to do a simple if or ifs statement which includes the search function. I want the search to look at the 1st column and search if it is adsl it is one price and if it is vdsl it i...
Twifoo
Nov 08, 2019Silver Contributor
Try this:
=IFERROR(CHOOSE(
MATCH(D5,
{“adsl”,”vdsl”},0),
Commercials!B$6,Commercials!B$7),
0)
=IFERROR(CHOOSE(
MATCH(D5,
{“adsl”,”vdsl”},0),
Commercials!B$6,Commercials!B$7),
0)
Mette820
Nov 08, 2019Copper Contributor
TwifooDoesn't seem to work. It is returning 0, I assume it is finding more than just Adsl and vdsl and therefore there is no match and the result is 0?
- TwifooNov 09, 2019Silver ContributorI inadvertently misconstrued the requirement. Thus, try this instead:
=IF(COUNTIF(D5,”*adsl*”),
Commercials!B$6,
IF(COUNTIF(D5,”*vdsl*”),
Commercials!B$7,
0))
The foregoing formula also considers the possibility that certain characters may precede or follow the search texts. The use of COUNTIF with wildcards is a shorter alternative to the ISNUMBER-SEARCH combination.