Divide Arrays

anthonyexcel

Active Member
Joined
Jun 10, 2011
Messages
258
Office Version
  1. 365
Platform
  1. Windows
I have 2 Arrays each located in a cell. I would like to divide the first one by the second one. Please see below.

[TABLE="class: tableizer-table"]
<tbody>[TR="class: tableizer-firstrow"]
[TH]Array[/TH]
[/TR]
[TR]
[TD]{0;1;0;1;0;0;1}[/TD]
[/TR]
[TR]
[TD]{0;1;2;2;0;1;2}[/TD]
[/TR]
</tbody>[/TABLE]

<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>



[TABLE="class: tableizer-table"]
<thead>[TR="class: tableizer-firstrow"]
[TH]Answer[/TH]
[/TR]
</thead><tbody> [TR]
[TD]{#DIV/0!;1;0;0.5,#DIV/0!,0,0.5}[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I have 2 Arrays each located in a cell. I would like to divide the first one by the second one. Please see below.

[TABLE="class: tableizer-table"]
<tbody>[TR="class: tableizer-firstrow"]
[TH]Array[/TH]
[/TR]
[TR]
[TD]{0;1;0;1;0;0;1}[/TD]
[/TR]
[TR]
[TD]{0;1;2;2;0;1;2}[/TD]
[/TR]
</tbody>[/TABLE]

<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>



[TABLE="class: tableizer-table"]
<tbody>[TR="class: tableizer-firstrow"]
[TH]Answer[/TH]
[/TR]
[TR]
[TD]{#DIV/0!;1;0;0.5,#DIV/0!,0,0.5}[/TD]
[/TR]
</tbody>[/TABLE]

you are getting an error #DIV/0! because u cant divide anything by 0! :)


if you are looking to populate 0 instead of the error, you can wrap it in an iferror, (which is equivalent to =0/0 which will equal 0...)

=IFERROR({0;1;0;1;0;0;1}/{0;1;2;2;0;1;2},0)

(if that doesnt work for you, pls respond how you get to the 2 arrays?)
 
Upvote 0
Hi dave2018,

Thanks for the reply. I am looking for a VBA Function something like =xArray(A2,A3) and that will return the answer {#DIV/0!;1;0;0.5,#DIV/0!,0,0.5} in another cell.
 
Upvote 0
Hi dave2018,

Thanks for the reply. I am looking for a VBA Function something like =xArray(A2,A3) and that will return the answer {#DIV/0!;1;0;0.5,#DIV/0!,0,0.5} in another cell.

care to post a snapshot of how it should look? or is this how it looks now?


im just wondering how you get the 2 arrays to begin with?
 
Last edited:
Upvote 0
dave2018, that is exactly what it looks like. It is part of some formula evaluation that I am doing.
 
Upvote 0
dave2018, that is exactly what it looks like. It is part of some formula evaluation that I am doing.

in my example, they are text.

Meaning, in A1: "{0;1;0;1;0;0;1}" Not: ={0;1;0;1;0;0;1}

in that case, you need to parse each value into a real array, not text values in 1 string...

=IFERROR(FILTERXML("<t><s>"&SUBSTITUTE(MID(A1,2,LEN(A1)-2),";","</s><s>")&"</s></t>",{"//s";"//s"})/FILTERXML("<t><s>"&SUBSTITUTE(MID(A2,2,LEN(A2)-2),";","</s><s>")&"</s></t>",{"//s";"//s"}),0)

here is a screenshot of when i evaluate F9 in edit mode:


does that work?
 
Upvote 0
dave2018 that seems to work!!! Thanks!! I never used the FILTERXML function!! Nice to know!!!
 
Upvote 0
dave2018 that seems to work!!! Thanks!! I never used the FILTERXML function!! Nice to know!!!

LOL. Me neither!! until 2 days ago when i saw it on stackoverflow here!! i am addicted to this formula!

(u probably understand the hack being worked here, but if not, i can try to explain)
 
Last edited:
Upvote 0
dave2018,

Thanks for the link!! Appreciate it!! LOL we are all addicted to something!!
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

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