Subsitute format

Emily

Active Member
Joined
Aug 28, 2002
Messages
304
The format for SUBSTITUTE should be, say:
SUBSTITUTE(A1, "0", "")

Why SUBSTITUTE(A1, {"0", "1", "2") , "") be accepted?

The substitute only replace the first element of the set, i.e 0 only.

Thanks.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
It seems you can't pass an array to SUBSTITUTE. Try:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"0",""),"1",""),"2","")
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
I think that was my point. You can't pass an array to SUBSTITUTE if used alone - it only evaluates the first aray element.

But SUBSTITUTE nested within a function which accepts an array (eg SUMPRODUCT) returns an array to that function. I wasn't aware of that, so thanks for the link.
 

Emily

Active Member
Joined
Aug 28, 2002
Messages
304

ADVERTISEMENT

But SUBSTITUTE nested within a function which accepts an array (eg SUMPRODUCT) returns an array to that function. I wasn't aware of that, so thanks for the link.

Andrew
Would you please give me an example.
Thanks
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
There's one in your link:

=SUBSTITUTE(A1,RIGHT(A1,SUMPRODUCT((LEN(A1)-LEN(SUBSTITUTE(A1,{0,1,2,3,4,5,6,7,8,9},""))))),"")

The second SUBSTITUTE passes an array to SUMPRODUCT.
 

Forum statistics

Threads
1,144,434
Messages
5,724,334
Members
422,545
Latest member
zillafreak

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
Top