compare subtraction in following numbers

excelNewbie22

Well-known Member
Joined
Aug 4, 2021
Messages
510
Office Version
  1. 365
Platform
  1. Windows
hello!
is there a better formula for checking ALL subtractions between two following/neighboring
(e2:d2 and h2:g2 and so on)
numbers if they are identical?

cause i want to modify the wanted formula for checking all kinds of rangers and it's tedious the way i wrote it
for example: i want to check if the subtraction of every two cells, i2-h2 and h2-g2 and etc are the same BUT without the subtraction of e2-d2
so i need a more flexible formula to adujst

test
CDEFGHIJ
11234567identical subtractions
224681012141
315225598991000
4101520253035401
test
Cell Formulas
RangeFormula
J2:J4J2=IF(AND(I2-H2=H2-G2,H2-G2=G2-F2,G2-F2=F2-E2,F2-E2=E2-D2,E2-D2=D2-C2),1,0)
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
in other words:
formula checking for any 3 or 4 or 5 or 6 identical subtractions between two following/neighboring cells
and the number (3 to 6) of identicals will be adjustable
 
Upvote 0
This array formula will tell you the number of matching subtractions but it includes all pairs, it does not exclude E2-D2. I'm unclear on that requirement because it is included in your own formula.

If you just want to know if there are at least three matches, instead of the number, then I showed that too. Note that these are array formulas.

$scratch.xlsm
CDEFGHIJK
11234567identical subtractions>=3
2246810121451
3152255989910010
41015202530354051
Subtractions
Cell Formulas
RangeFormula
J2:J4J2=SUM(IF(E2:I2-D2:H2=D2:H2-C2:G2,1,0))
K2:K4K2=IF(SUM(IF(E2:I2-D2:H2=D2:H2-C2:G2,1,0))>=3,1,0)
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
your way is better, just knowing how many identical subtractions, J2:J4,
but something is missing,
and i think my way before was confusing, (even to me)
right now there's 6 identical subtractions,
and if i change g2 to 9
the formula won't calculate into account the subtraction of i2-h2

i think what i'm trying to say is i want to know just how many identical subtractions there is?
which for that example is 6
 
Upvote 0
I think you need to clarify your requirements. You said
identical subtractions between two following/neighboring cells
But there are only 5 pairs of neighboring subtractions, even though there are 6 subtractions.
 
Upvote 0
you are right,
i want to know just how many identical subtractions there is in a range in of neighboring cells but without comparing them

but now i thought,
what if there's two subtractions of 2's
and two of 5's?
i don't have an idea how to present it
do you have an idea to help me?

test.xlsx
ABCDEFGH
11234567identical subtractions
224681012146
315225598991002
4101520223238402 of 5's and 2 of 2's
test
 
Upvote 0
I think it would be helpful for you to explain why you need to do this. We need to look at a better overall solution. We need to look at information, rather than cells.
 
Upvote 0
kinda private project of mine,
thanks for bearing
think there's a right formula?
just for identical subtractions in a range of neighboring cells without comparing them
as for the mention problem above, i'll place it on hold
 
Upvote 0
I'm taking a stab at this, but I'm also a bit confused, but see if this might be a bit closer:

Book1
CDEFGHIJKLM
11234567Most common difference# of MCD
2246810121426
3152255989910012
41015202530354056
5246910121424
62461116218853
Sheet8
Cell Formulas
RangeFormula
L2:L6L2=MODE((D2:I2-C2:H2)*{1;1})
M2:M6M2=SUMPRODUCT(--(D2:I2-C2:H2=L2))
Press CTRL+SHIFT+ENTER to enter array formulas.


Notice that on the last row, there were 3 differences of 2, and 3 differences of 5, but only 5 showed up. Do you want both to show up somehow?
 
Upvote 0
Solution

Forum statistics

Threads
1,214,793
Messages
6,121,617
Members
449,039
Latest member
Mbone Mathonsi

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