Major design flaw in Union "operator"

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,676
Office Version
  1. 365
Platform
  1. Windows
I just discovered what I consider a major flaw in the design of the Union (comma) operator. As illustrated in the workbook here:

https://www.dropbox.com/sh/v0799qr2uex4imf/AAAWi4Jhq4-vfCmuQTn4qo4Za?dl=0

The Sum function, when applied to a union of overlapping ranges, will sum the values in the overlapping area multiple times. Mathematically, this is nonsense. What possible rationale could the geniuses at M$FT possibly have had in mind?

I am inclined to agree with opinions expressed here,

http://dailydoseofexcel.com/archives/2005/01/16/union-and-intersect/

that they just had this "operator", the comma, already implemented and decided to call it an operator and ignore the fact that it is mathematically wrong.

I would love to hear a compelling defense of this design.

PS: It looks like a couple of my personal UDFs, which I moved to a code module, may not be working in the workbook. My apologies if that's true. I would also appreciate any hints of how I can make that work when I send workbooks to other people that make use of any of my personal add-in code.
 
The comma in =SUM(K1:K6,K5:K11) is seperating two arguments of SUM, not creating a union of ranges

SUM(x, y) = SUM(x) + SUM(y) so it is returning the correct value.
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
The comma in =SUM(K1:K6,K5:K11) is seperating two arguments of SUM, not creating a union of ranges
That may be true, but still, this does create a union and it will returns 13 as well...

=SUM((K1:K6,K5:K11))

I have often wondered when a function allows for multiple range arguments whether the comma is acting as a separator or as a union operator given the end result appears to be the same.
 
Last edited:
Upvote 0
The comma in =SUM(K1:K6,K5:K11) is seperating two arguments of SUM, not creating a union of ranges

SUM(x, y) = SUM(x) + SUM(y) so it is returning the correct value.
Aha! Of course. Good catch. :oops:

So the design flaw is different from what I initially thought. It's that they choose to use the same symbol, the comma, for a set operator, that already had a function as an argument delimiter. I actually think that dumber than the error I thought it was. It doesn't require any knowledge of set theory -- just of their own syntax. :banghead:

So is there any way to get the actual Union operator to work? I tried
Code:
=SUM((K1:K6,K5:K11))
but got the same sum.
 
Upvote 0
To me, the question is: is there an example where the comma in (K1:K6,K5:K11) acts as a true union operator, and not as a separator?
Exactly. So, is there? :cool:

I tried
Code:
=COUNT(K1:K6,K5:K11)
=COUNT((K1:K6,K5:K11))
They both return 13.
 
Upvote 0
In this thread from 2009, someone asks why the arguments in his function calls are separated by semicolons, instead of commas.

https://www.mrexcel.com/forum/excel-questions/385317-semicolon-comma-regional.html

The answer is that it is needed because the comma, not the period, is the decimal separator in many countries. I am reluctant to mess with the regional settings because it affects all programs, but if I were to change the decimal separator to a comma, which appears to make the argument separator the semicolon, would the comma then become the Union operator. Naw, probably not because it would then be confused with the decimal separator.
 
Upvote 0
There is no Excel operator that produces a union like a set theory union.
 
Upvote 0
I just learned something from this page:

http://www.excel-first.com/excel-reference-operators/

If I type "K1:K6,K5:K11" into the Name Box, the tallies at the bottom right of the sheet show:

Average: 1 Count: 11 Sum: 11

This would seem to indicate that the Union operation is working properly. The problem is that we can't get to is because the argument separator gets executed first. It wold seem that enclosing the whole argument in parens should do the trick, but it doesn't seem to.

Code:
=sum((K1:K6,K5:K11))
 
Upvote 0
There is no Excel operator that produces a union like a set theory union.

How do you know that? What is that based on? Do you have a reference in M$FT literature somewhere?

My experiment above with the Name Box seems to suggest otherwise.
 
Upvote 0

Similar threads

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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