Counting how much number is in ascending order in a row.

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
Using Excel 2010
Hello,

I need a Formula or VBA which can count numbers are ascending order in a row. From the 1st starting number, for example…..

Row1 (4-7-8-10) =4, row2 (4-7-18) =3, row3 (4-7) =2, row5 (4-7-8-10-39) =5

n1n2n3n4n5Ans
4781094
47181093
471210292
47810395

Regards,
Moti
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Not saying I'll answer this but
Will there only ever be 5 columns to check?
Also what happens if one of your rows reads

1 - 2 - 1 - 3 - 4

Is the result 2 (1 -2)
or 3 (1 - 3 -4) ?
 
Upvote 0
Not saying I'll answer this but
Will there only ever be 5 columns to check?
Also what happens if one of your rows reads

1 - 2 - 1 - 3 - 4

Is the result 2 (1 -2)
or 3 (1 - 3 -4) ?
Hello Special-K99, in this case....the result 2 (1 -2)
 
Upvote 0
Hello Special-K99, in this case....the result 2 (1 -2)
It sounds then that the increasing values must start in thee first column. If that is so, try
(Looks to me like your third example result is incorrect since 4-7-12 is increasing)

24 02 26.xlsm
ABCDEF
1n1n2n3n4n5Ans
24781094
347181093
4471210293
547810395
6151210871
7476892
Ascending
Cell Formulas
RangeFormula
F2:F7F2=IFERROR(MATCH(TRUE,B2:E2<A2:D2,0),5)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 1
It sounds then that the increasing values must start in thee first column. If that is so, try
(Looks to me like your third example result is incorrect since 4-7-12 is increasing)

24 02 26.xlsm
ABCDEF
1n1n2n3n4n5Ans
24781094
347181093
4471210293
547810395
6151210871
7476892
Ascending
Cell Formulas
RangeFormula
F2:F7F2=IFERROR(MATCH(TRUE,B2:E2<A2:D2,0),5)
Press CTRL+SHIFT+ENTER to enter array formulas.
Hello Peter_SSs, this is what I wanted worked beautifully. Thank you for your help.

Good Luck.

Kind Regards,
Moti :)
 
Upvote 0
Hello Peter_SSs, this is what I wanted worked beautifully. Thank you for your help.

Good Luck.

Kind Regards,
Moti :)
Hello Peter_SSs, your given formula according to my opening post is working fine.

I have come up with another problem adding duplicate data; formula also is giving the correct results as long as numbers are in ascending order.

My request is if there are duplicate can I get answer 0. Please can you take a look and make it possible new request.

Book1.xlsx
ABCDEFGH
1n1n2n3n4n5AnsAns
24781094ok
347181093ok
4471210293ok
547810395ok
6151210871ok
7476892ok
8
9AnsAns
10212121314150
11212122344550
12212222354150
13212424394450
14212121214950
15262629294850
16212234344550
Sheet1
Cell Formulas
RangeFormula
F10:F16,F2:F7F2=IFERROR(MATCH(TRUE,B2:E2<A2:D2,0),5)
Press CTRL+SHIFT+ENTER to enter array formulas.


Good Luck.

Kind Regards,
Moti
 
Upvote 0
My request is if there are duplicate can I get answer 0
Clarification needed. In all of your examples in the bottom sections thee number are increasing or equal as you go from left to right & the original formula gave a "5" result.
What about examples like the ones below where the original formula gives a different answer? Do you want these to return 0 as well or keep the original result or give yet another result?

24 02 26.xlsm
ABCDEF
1821221818452
1921222218453
Ascending (2)
Cell Formulas
RangeFormula
F18:F19F18=IFERROR(MATCH(TRUE,B18:E18<A18:D18,0),5)
 
Upvote 0
Clarification needed.
Hello Peter_SSs, thank you for asking the question. I have amended all data including your example I want the result as shown in the column F.

Give me counts of the numbers are in ascending order. But if the row contains duplicate numbers, than result must be 0.

For example in the row 2, 3, 4, 5, 6 & 7 there are NO DUPLICATE so far give count of the numbers are in ascending order as it gives in range F2:F7 are correct. If there are DUPLICATING in the row than return “0” as shown in the range F8:F16. Hope this help.

Book1.xlsx
ABCDEF
1n1n2n3n4n5Ans
24781094
347181093
4471210293
547810395
6151210871
7476892
821212131410
921212234450
1021222235410
1121242439440
1221212121490
1326262929480
1421223434450
1521221818450
1621222218480
Sheet1


Kind Regards,
Moti
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

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