SUMPRODUCT: Having a dynamic range of cells to search for

samgil

New Member
Joined
Apr 20, 2017
Messages
19
Hi Gang,

I want to change this:

=SUMPRODUCT(--ISNUMBER(SEARCH({"A1","A2","A3"},C1)))>0

to be a range like A1:A10 instead of "a1", "a2", "a3". However, if none of the cells in the range A1:A10 match C1, yet are empty, it will still return TRUE for some reason.

 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
There might be a better solution, but try this as an array formula:

{=IF(SUM(IF(--ISNUMBER(SEARCH("SEARCHVALUE",A1:A10))<>0,A1:A10,0))=0,FALSE,TRUE)}

To make this an array formula follow these steps:
1.Paste this into the cell: =IF(SUM(IF(--ISNUMBER(SEARCH("SEARCHVALUE",A1:A10))<>0,A1:A10,0))=0,FALSE,TRUE)
2.Double click into the cell and press cnrl+shift+enter
3.You will see brackets appear around the function indicating that you created an array formula.
 
Last edited:
Upvote 0
There might be a better solution, but try this as an array formula:

{=IF(SUM(IF(--ISNUMBER(SEARCH("SEARCHVALUE",A1:A10))<>0,A1:A10,0))=0,FALSE,TRUE)}

To make this an array formula follow these steps:
1.Paste this into the cell: =IF(SUM(IF(--ISNUMBER(SEARCH("SEARCHVALUE",A1:A10))<>0,A1:A10,0))=0,FALSE,TRUE)
2.Double click into the cell and press cnrl+shift+enter
3.You will see brackets appear around the function indicating that you created an array formula.


Sorry I don't quite follow. I don't believe that's checking if my value in B1 is in A1:A10?

For more context, this is for a sumproduct formula to search a dataset, and add all the rows where B1 is found. So for this example I made it A1:A10 as the range to look for B1.
 
Upvote 0
Awesome, many thanks! Final Question - Is there a way to change it from being a 'contains' search, to 'exact match'?

Sure, and then you don't even need the additional condition to test for emptiness:

=SUMPRODUCT(--(A1:A10=C1))>0

Regards
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,123
Members
452,546
Latest member
Rafafa

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