Function SEQUENCE is producing errors.

DRSteele

Well-known Member
Joined
Mar 31, 2015
Messages
2,654
Office Version
  1. 365
Platform
  1. Windows
The new Excel function SEQUENCE seems to be producing errors. I want a sequence of values from -50% to 50% with a 5 point step.

Put this in a cell and evaluate it in Edit mode by pressing f9.

=SEQUENCE(21,,-0.5,0.05)

Not only is the 0 a wonky exponent, some of the other values near zero are weird, to wit:
={-0.5;-0.45;-0.4;-0.35;-0.3;-0.25;-0.2;-0.15;-0.1;-0.0500000000000001;-6.93889390390723E-17;0.0499999999999999;0.0999999999999999;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5}

I need the values to be exact and as expected. Does anyone have any insight?

I realise that one solution is to eliminate the decimals and divide it at the end, but that is not ideal as a solution.

=SEQUENCE(21,,-50,5)/100
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
The problem is not with the sequence function, it's to do with Floating-point Precision
 
Upvote 0
There is no division that would produce a precision error. I have trouble believing Excel can't add .05 to -.5 to get -.45 etc.

There must be something else going on with SEQUENCE.
 
Upvote 0
Upvote 0
Computers dont store numbers as decimals though. They store them as binary numbers.
 
Upvote 0
DRSteele!!!! Ya, what everyone said say about how Excel store numbers : ) I often have this problem with many other formulas. I just use ROUND, like =ROUND(SEQUENCE(21,,-0.5,0.05) ,n).
 
Upvote 0
Thank you Steve, Fluff and Mike.

I still don't understand the floating-point article (mostly because the pictures are absent from the webpage). I'll guess we can handle things with a workaround like ROUND.
 
Upvote 0
It's still vexing to me. I know that you're right, it must be true - but it is beyond my comprehension.

I stumbled across this today, which says: "Fixed an issue where decimal values in the SEQUENCE function were not rounded correctly."

I tried =SEQUENCE(41,,-1,0.05) and it worked better but still produces an error at zero.
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

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