Curly Brackets but not an array?

Ally72

New Member
Joined
Mar 18, 2010
Messages
39
Hi

I've been given a spreadsheet to work through and there's a formula that I've never seen before.

It's
=IF(SUM(COUNTIF(E3,{"*M*","*T*","*W*","*F*"})),"O","")

The curly brackets are there whether Ctrl Shift and Enter is used or not. The only time I've seen curly brackets are for arrays and they go round the outside.

The M, T etc are referring Monday, Tuesday / Thursday, Wednesday and Friday.

Can anyone help decipher this please? I know what it's doing per se, and have tried to replicate using OR just to make sure, but haven't managed it yet!
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
The curly brackets in this case is an array for your criteria. Putting SUM prior to the COUNTIF allows the COUNTIF to perform its duties on all criteria within the curly brackets.

For example, it will first perform the COUNTIF with a criteria of "*M*" (the asterisk here being a wildcard meaning that text can be present on either side but can also be stand-alone).

It will then perform the COUNTIF with "*T*" (the asterisk doing the same thing here again)

and so on...

Then it will SUM the values of all these COUNTIF's to give you the value.

If I had text in cell E3 of "123M456", the first COUNTIF would give me a value of 1, the succeeding 3 other COUNTIF's ("*T*" ,"*W*","*F*") would give me 0,0,0 respectively. Sum that up you will get 1.

IF I had "M43754F5" in cell E3, i would get 1,0,0,1 . SUM that up and you will get 2.

If you want to see how it works better, go to the Formulas tab on the ribbon and press Evaluate Formula (with the cell selected)

HTH
 
Upvote 0

Forum statistics

Threads
1,213,532
Messages
6,114,176
Members
448,554
Latest member
Gleisner2

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