Search for multiple substrings and return different values [Solved/Closed]

jotied 3 Posts Wednesday September 9, 2015Registration date September 9, 2015 Last seen - Sep 9, 2015 at 05:20 PM - Latest reply: jotied 3 Posts Wednesday September 9, 2015Registration date September 9, 2015 Last seen
- Sep 9, 2015 at 09:24 PM
I have a cell I2 which contains long string. I want to find out the following:
If string in I2 contains "month", then return "Monthly",
If string in I2 contains "year", then return "Yearly",
Else, return "other".

I am using the following formula, but I'm just getting #VALUE.
=IF(OR(ISNUMBER(SEARCH("month",I2)),"Monthly",(ISNUMBER(SEARCH(year,I2)))),"Yearly","Other")

I would appreciate any help or if you can please point out what I may be doing wrong. Thanks a bunch!
See more 

2 replies

Best answer
Mazzaropi 1834 Posts Monday August 16, 2010Registration dateContributorStatus May 30, 2018 Last seen - Sep 9, 2015 at 08:48 PM
1
Thank you
jotied, Good evening.

Try to use:

=IF(ISNUMBER(SEARCH("month",I2)),"Montly",IF(ISNUMBER(SEARCH("year",I2)),"Yearly","Others"))

Is that what you're looking for?
I hope it helps.
--
Belo Horizonte, Brasil.
Marcílio Lobão

Thank you, Mazzaropi 1

Something to say? Add comment

CCM has helped 1664 users this month

jotied 3 Posts Wednesday September 9, 2015Registration date September 9, 2015 Last seen - Sep 9, 2015 at 09:24 PM
Marcílio - That did it! Thank you very much!

For anyone else out there, I also tweaked the formula a bit to get another value. I have two columns, one with "payment amount- column I" and another with "payment frequency- column V". I was ultimately trying to find the average revenue per user per month. To get that, I just had the formula print the value from V column in case the payment frequency was monthly. If payment frequency was yearly, I had the formula divide the value in V column by 12. See below for example and I hope it helps someone else out.

=IF(ISNUMBER(SEARCH("month",I2)),V2,IF(ISNUMBER(SEARCH("year",I2)),V2/12,"Other"))


p.s. I'm starting the formulas in row 2, thus using 2 on all columns (e.g. I2, V2).