Array with OR Criteria

alexcr

Board Regular
Joined
Oct 15, 2018
Messages
61
Office Version
  1. 365
Platform
  1. Windows
Let's say "A1#" refers to an array with four rows: "Apple", "Banana", "Orange","Peach".

And let's say you want to check each row/cell to see if it is either "Banana" or "Peach".

The formula "=IF(A1#={"Banana","Peach"},1,0)" produces a 2x4 array, instead of the desired 1x4 column, so I thought maybe the solution would be "=SUM(IF(A1#={"Banana","Peach"},1,0))", but this sums up the entire array, instead of summing up each row, resulting in a single 1x1 cell.

How do I do this so that I checks each row, producing the desired 1x4 array? (Obviously, this could easily be done without an array by copying and pasting a formula for each cell, but I'd like to accomplish this as an array.)

Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
What is the expected output?
 
Upvote 0
Ok, how about
Excel Formula:
=(A1#="Banana")+(A1#="Peach")
 
Upvote 1
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,507
Messages
6,125,212
Members
449,214
Latest member
mr_ordinaryboy

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