Find and count only numbers are finding, before the exact match number

Kishan

Well-known Member
Joined
Mar 15, 2011
Messages
1,648
Office Version
  1. 2010
Platform
  1. Windows
Using Excel 2000

Hi,

I want to count only the numbers (not the empty cells) are finding before the exact match number in the each row for example...

In the column "A" I have list of exact match numbers, in the C3:V20 list of numbers I am looking a formula which can look number are in the column "A" and count in the row numbers are found before it.

Example1 A3 has number 7 I want this number to be looked in the range C3:V3 and count the numbers before the 7 which counts are 6, formula result in cell X3=6

Example3 A4 has number 14 I want this number to be looked in the range C4:V4 and count the numbers before the 14 which counts are 11, formula result in cell X4=11

NumbersC1C2C3C4C5C6C7C8C9C10C11C12C13C14C15C16C17C18C19C20Result
7123456789101112131415171819206
141234568910111214151718192011
4123456891011121517203
15123568910111215172010
3312356891011121720
3123568910111217202
412568911121720
11256891117200
1425689111720

Thank you in advance

Regards,
Kishan
 

Attachments

  • Find and Count before exact number.png
    Find and Count before exact number.png
    15.8 KB · Views: 7

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
That's very confusing. Do you mean CELL "C3" or the CELL labeled with a "C3" ?

For the 14, starting in the column LABELED C2, there are then 10 and not 11 as you show above.

Book6
ABCDEFGHIJKLMNOPQRSTUVWX
1
2NumbersC1C2C3C4C5C6C7C8C9C10C11C12C13C14C15C16C17C18C19C20Result
37123456789101112131415171819206
4141234568910111214151718192010
54123456891011121517201
61512356891011121517207
733123568910111217209
83123568910111217200
94125689111217200
1011256891117200
1114256891117202
Sheet17
Cell Formulas
RangeFormula
X3:X11X3=COUNTIF(OFFSET(C3,0,ROW()-3):V3,"<"&A3)
 
Upvote 0
That's very confusing. Do you mean CELL "C3" or the CELL labeled with a "C3" ?

For the 14, starting in the column LABELED C2, there are then 10 and not 11 as you show above.

Book6
ABCDEFGHIJKLMNOPQRSTUVWX
1
2NumbersC1C2C3C4C5C6C7C8C9C10C11C12C13C14C15C16C17C18C19C20Result
37123456789101112131415171819206
4141234568910111214151718192010
54123456891011121517201
61512356891011121517207
733123568910111217209
83123568910111217200
94125689111217200
1011256891117200
1114256891117202
Sheet17
Cell Formulas
RangeFormula
X3:X11X3=COUNTIF(OFFSET(C3,0,ROW()-3):V3,"<"&A3)
Hi kweaver, you got my idea it is exact layout, thank you for the formula, I am not getting the result as per my #post1.

Please can you check it? If you check row 4 there are 11 numbers before 14 so X4 result must be 11, in X5 must be 3 and so on...

kind Regards,
Kishan
 
Upvote 0
11 numbers before 14 would start the count in column C.
Then, by that logic, there are 3 numbers before 4 in the next row and you show the result should be 1.
 
Upvote 0
Give this formula a try...
Excel Formula:
=IFERROR(COUNTIF(C3:INDEX(C3:V3,1,MATCH(A3,C3:V3,0)),"<>")-1,"")
 
Upvote 0
11 numbers before 14 would start the count in column C.
Then, by that logic, there are 3 numbers before 4 in the next row and you show the result should be 1.
Hi kweaver, if you see the image attached it shows clearly, if start counting from column C till the target number found yes before the 14 in the row4 there are 11 numbers and in the row5 there are 3 numbers before the 4 it is shown correctly but I think having a problem not showing the column and row description has created the confusion.

I appreciate your help

Kind Regards,
Kishan
 
Upvote 0
Give this formula a try...
Excel Formula:
=IFERROR(COUNTIF(C3:INDEX(C3:V3,1,MATCH(A3,C3:V3,0)),"<>")-1,"")
Hi Rick Rothstein, after inserting formula I got error #¿NAME? Searching in the excel forums I found that the "IFERROR" function is not compatible with excel 2000, as the formula was perfect and worked well without trapping the error like this
VBA Code:
=CONTAR.SI(C3:INDICE(C3:V3;1;COINCIDIR(A3;C3:V3;0));"<>")-1
But now it were giving different error #N/A, searching again in the excel forums find the solution adapting it within your formula it has worked fine.
Code:
=IF(ISERROR(COUNTIF(C3:INDEX(C3:V3,1,MATCH(A3,C3:V3,0)),"<>")),"",COUNTIF(C3:INDEX(C3:V3,1,MATCH(A3,C3:V3,0)),"<>")-1)

I appreciate your kind help for solving my request.

Kind Regards,
Kishan
 
Upvote 0
Does this summarize it?

Book6
X
36
411
53
610
70
82
90
100
110
Sheet17
Cell Formulas
RangeFormula
X3:X11X3=IF(0=COUNTIF(C3:V3,A3),0,COUNTIF(C3:V3,"<"&A3))
 
Last edited:
Upvote 0
Solution
Does this summarize it?

Book6
X
36
411
53
610
70
82
90
100
110
Sheet17
Cell Formulas
RangeFormula
X3:X11X3=IF(0=COUNTIF(C3:V3,A3),0,COUNTIF(C3:V3,"<"&A3))
Hi kweaver, Yes indeed this is a perfect!! Also it is a simple and the finest formula solution. I like it very much. I will replace and will go with your solution.

I do appreciate your help and time you spent to solve it in one go.

Kind Regards,
Kishan :)
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,585
Members
448,972
Latest member
Shantanu2024

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