How to convert an array of zeros into an arry of true and false?

Luthius

Active Member
Joined
Apr 5, 2011
Messages
324
How to convert an array of zeros into an array of true and false without use IF formula?

FROM
{0;1;0;1;0;1}

TO
{FALSE;TRUE;FALSE;TRUE;FALSE;TRUE}

Ps. The array of false and true, within a formula.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Almost there...<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Well, look this<o:p></o:p>
<o:p></o:p>
Rich (BB code):
STEP 01<o:p></o:p>
=AVERAGE(({4,5,6,7,8,9,10}>=2)*({4,5,6,7,8,9,10}<=8)*({4,5,6,7,8,9,10}))
<o:p></o:p>
<o:p></o:p>

Rich (BB code):
<o:p></o:p>
RESULTS<o:p></o:p>
<o:p></o:p>
=AVERAGE({1,1,1,1,1,0,0}*{4,5,6,7,8,9,10})<o:p></o:p>
<o:p></o:p>
Resulting in 4,285714286.<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
This results is because the zeros inside the formula.<o:p></o:p>
But What I'm trying to do is get the result without use 'IF' formula.<o:p></o:p>
Using IF Formula
<o:p></o:p>
<o:p></o:p>
Rich (BB code):
Step 1<o:p></o:p>
AVERAGE(IF({4,5,6,7,8,9,10}>=2,IF({4,5,6,7,8,9,10}<=8,{4,5,6,7,8,9,10}))) 
<o:p></o:p>
<o:p></o:p>

Rich (BB code):
<o:p></o:p>
RESULTS<o:p></o:p>
<o:p></o:p>
=AVERAGE(IF({TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE},{4,5,6,7,8,FALSE,FALSE})<o:p></o:p>
<o:p></o:p>
STEP 2<o:p></o:p>
AVERAGE({4,5,6,7,8,FALSE,FALSE})<o:p></o:p>
<o:p></o:p>
Resulting in 6.

With FALSE inside, the formula ignore it, and give me the real average.
 
Upvote 0
Why not use IF?

=AVERAGE(IF(({4,5,6,7,8,9,10}>=2) * ({4,5,6,7,8,9,10}<=8), {4,5,6,7,8,9,10}))
 
Upvote 0
Excel treats true as 1 and false as 0 in mathematical operations - which is what happens here since you multiply the true/false results. I'm not aware of anyway around that (except applying IF to the results - so back to where you started).
 
Upvote 0
Yes excel treats this way false and true.
Thats the reason I came here.
To put a new challenge for us. Solve it without use IF formula.
 
Upvote 0
It really might help to explain why you want to do this.

Like xenou said, 0 and False are in many respects the same as far as Excel is concerned, so why even bother to differentiate ?
 
Upvote 0
FROM
{0;1;0;1;0;1}

TO
{FALSE;TRUE;FALSE;TRUE;FALSE;TRUE}

Try:
NOT(NOT({0;1;0;1;0;1}))

But this isn't really what you want - you want 0's converted to FALSE and other numbers to remain what they are (not to become TRUE's).
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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