Combined IF/OR statement with the OR based on a group of values in cells

gberg

Board Regular
Joined
Jul 16, 2014
Messages
205
Office Version
  1. 365
Platform
  1. Windows
I am trying to come up with a formula that I won't have to list out each specific value for all of the "OR"s

I have a list of "Fuel Categories" that I want to reference but not individual values. They are in Cells V2 to V16
Fuel Categories
7-ELEVEN
BPPRODUCTS
EXXONMOBIL
SHEETZ
SHELL
SUNOCO
UNBRANDED
UNKNOWN
WAWA
Future Station
Future Station
Future Station
Future Station
Future Station
Future Station

This is the formula I have
Excel Formula:
=IF(OR(COUNTIF([@[Item/Service Description]],"*"&$V$2&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$3&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$4&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$5&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$6&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$7&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$8&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$9&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$10&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$11&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$12&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$13&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$14&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$15&"*"),COUNTIF([@[Item/Service Description]],"*"&$V$16&"*")),"Fuel","")

I wanted something like this but just don't know how to make it work

Excel Formula:
=IF(OR([@[Item/Service Description]]="*"&$V$2:$V$16&"*"),"Fuel","")
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
How about
Excel Formula:
=IF(SUM(COUNTIFS([@[Item/Service Description]],"*"&$V$2:$V$16&"*")),"Fuel","")
 
Upvote 0
Maybe something like this?
Excel Formula:
=IF((SUM(--ISNUMBER(SEARCH($V$3:$V$17, [@[Item/Service Description]]))))>0, "Fuel","")

EDIT:
Looks like Fluff beat me to it, and Fluff usually catches edge cases that I miss, so I'd go with the previous answer.
 
Upvote 0
Solution
They both work, wish I could check both of them as the correct answer. There are amazing people on this board! Thanks for your help!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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