Extract all cells from a column that meet criteria

yaniv_sa

New Member
Joined
Nov 4, 2018
Messages
7
Hey,
I have a colum A (in sheet '2174') that have this kind of data:

[TABLE="width: 79"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]1335001410[/TD]
[/TR]
[TR]
[TD="align: right"]1335003990[/TD]
[/TR]
[TR]
[TD="align: right"]1341000930[/TD]
[/TR]
[TR]
[TD="align: right"]1341001790[/TD]
[/TR]
[TR]
[TD="align: right"]1341001930[/TD]
[/TR]
[TR]
[TD="align: right"]1341001990[/TD]
[/TR]
[TR]
[TD="align: right"]1341002930[/TD]
[/TR]
[TR]
[TD="align: right"]1341002990[/TD]
[/TR]
[TR]
[TD="align: right"]1341003930[/TD]
[/TR]
[TR]
[TD="align: right"]1841060182[/TD]
[/TR]
[TR]
[TD="align: right"]1841060471[/TD]
[/TR]
[TR]
[TD="align: right"]1842200760[/TD]
[/TR]
[TR]
[TD="align: right"]1842201840[/TD]
[/TR]
[TR]
[TD="align: right"]1842202841[/TD]
[/TR]
[TR]
[TD="align: right"]1842203840[/TD]
[/TR]
[TR]
[TD="align: right"]1842203841[/TD]
[/TR]
[TR]
[TD="align: right"]1842205840[/TD]
[/TR]
[TR]
[TD="align: right"]1842206840[/TD]
[/TR]
[TR]
[TD="align: right"]1842207810[/TD]
[/TR]
</tbody>[/TABLE]

i want to extract only number that meet this crateria to the main sheet (colum A):
if > 1600000000 and last 3 digits 930 or <1600000000 and last 3 digits are 840.
with out VBA

the result should be like this:
[TABLE="width: 79"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]1341000930[/TD]
[/TR]
[TR]
[TD="align: right"]1341001930[/TD]
[/TR]
[TR]
[TD="align: right"]1341002930[/TD]
[/TR]
[TR]
[TD="align: right"]1341003930[/TD]
[/TR]
[TR]
[TD="align: right"]1842201840[/TD]
[/TR]
[TR]
[TD="align: right"]1842203840[/TD]
[/TR]
[TR]
[TD="align: right"]1842205840[/TD]
[/TR]
[TR]
[TD="align: right"]1842206840[/TD]
[/TR]
</tbody>[/TABLE]

I have tried may options with match and index but couldn't get it right.

please help.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi

Your results don't comply with your criteria.
Example: 1341000930
Is >
1600000000 but the last 3 digits are NOT 930.

 
Upvote 0
Okay. I also made a mistake.
Let me show you in boolean logic.
ABCD
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH

<tbody>
[TD="colspan: 5"]Arbeitsblatt mit dem Namen 'Tabelle1'[/TD]

[TD="bgcolor: #cacaca"]1[/TD]
[TD="align: left"]Number[/TD]
[TD="align: left"]Last 3 digits[/TD]
[TD="align: left"]<1600000000 AND =840[/TD]
[TD="align: left"]>1600000000 AND =930[/TD]

[TD="bgcolor: #cacaca"]2[/TD]
[TD="align: right"]1335001410[/TD]
[TD="align: right"]410[/TD]

[TD="bgcolor: #cacaca"]3[/TD]
[TD="align: right"]1335003990[/TD]
[TD="align: right"]990[/TD]

[TD="bgcolor: #cacaca"]4[/TD]
[TD="align: right"]1341000930[/TD]
[TD="align: right"]930[/TD]

[TD="bgcolor: #cacaca"]5[/TD]
[TD="align: right"]1341001790[/TD]
[TD="align: right"]790[/TD]

[TD="bgcolor: #cacaca"]6[/TD]
[TD="align: right"]1341001930[/TD]
[TD="align: right"]930[/TD]

[TD="bgcolor: #cacaca"]7[/TD]
[TD="align: right"]1341001990[/TD]
[TD="align: right"]990[/TD]

[TD="bgcolor: #cacaca"]8[/TD]
[TD="align: right"]1341002930[/TD]
[TD="align: right"]930[/TD]

[TD="bgcolor: #cacaca"]9[/TD]
[TD="align: right"]1341002990[/TD]
[TD="align: right"]990[/TD]

[TD="bgcolor: #cacaca"]10[/TD]
[TD="align: right"]1341003930[/TD]
[TD="align: right"]930[/TD]

[TD="bgcolor: #cacaca"]11[/TD]
[TD="align: right"]1841060182[/TD]
[TD="align: right"]182[/TD]

[TD="bgcolor: #cacaca"]12[/TD]
[TD="align: right"]1841060471[/TD]
[TD="align: right"]471[/TD]

[TD="bgcolor: #cacaca"]13[/TD]
[TD="align: right"]1842200760[/TD]
[TD="align: right"]760[/TD]

[TD="bgcolor: #cacaca"]14[/TD]
[TD="align: right"]1842201840[/TD]
[TD="align: right"]840[/TD]

[TD="bgcolor: #cacaca"]15[/TD]
[TD="align: right"]1842202841[/TD]
[TD="align: right"]841[/TD]

[TD="bgcolor: #cacaca"]16[/TD]
[TD="align: right"]1842203840[/TD]
[TD="align: right"]840[/TD]

[TD="bgcolor: #cacaca"]17[/TD]
[TD="align: right"]1842203841[/TD]
[TD="align: right"]841[/TD]

[TD="bgcolor: #cacaca"]18[/TD]
[TD="align: right"]1842205840[/TD]
[TD="align: right"]840[/TD]

[TD="bgcolor: #cacaca"]19[/TD]
[TD="align: right"]1842206840[/TD]
[TD="align: right"]840[/TD]

[TD="bgcolor: #cacaca"]20[/TD]
[TD="align: right"]1842207810[/TD]
[TD="align: right"]810[/TD]

</tbody>

ZelleFormel
B2=--RIGHT([@Number],3)
C2=AND([@Number]<1600000000,[@[Last 3 digits]]=840)
D2=AND([@Number]>1600000000,[@[Last 3 digits]]=930)

<tbody>
</tbody>
Verwendete Systemkomponenten: [Windows (32-bit) NT 6.01] MS Excel 2016
Diese Tabelle wurde mit Tab2Html (v2.6.0) erstellt. ©Gerd alias Bamberg

<tbody>
</tbody>

FALSCH is german for FALSE.
No number meets your criteria.
 
Upvote 0

Book1
A
21335001410
31335003990
41341000930
51341001790
61341001930
71341001990
81341002930
91341002990
101341003930
111841060182
121841060471
131842200760
141842201840
151842202841
161842203840
171842203841
181842205840
191842206840
201842207810
2174



Book1
A
11600000000
2930
3840
48
51341000930
61341001930
71341002930
81341003930
91842201840
101842203840
111842205840
121842206840
main


shift-del is right. We need to change the 1600000000 test in accordance with the results you want to obtain.


In A4 of main control+shift+enter, not just enter:

=SUM(IF('2174'!A2:A20<A1,IF(RIGHT('2174'!A2:A20,3)+0=A2,1))+IF('2174'!A2:A20>A1,IF(RIGHT('2174'!A2:A20,3)+0=A3,1)))

In A5 of main control+shift+enter, not just enter, and copy down:

=IF(ROWS($A$5:A5)>$A$4,"",INDEX('2174'!$A$2:$A$20,SMALL(IF(('2174'!$A$2:$A$20 < $A$1)*(RIGHT('2174'!$A$2:$A$20,3)+0=$A$2)+('2174'!$A$2:$A$20 > $A$1)*(RIGHT('2174'!$A$2:$A$20,3)+0=$A$3),ROW('2174'!$A$2:$A$20)-ROW(INDEX('2174'!$A$2:$A$20,1,1))+1),ROWS($A$5:A5))))
 
Upvote 0
Okay. I also made a mistake.
Let me show you in boolean logic.
ABCD
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH
FALSCHFALSCH

<tbody>
[TD="colspan: 5"]Arbeitsblatt mit dem Namen 'Tabelle1'[/TD]

[TD="bgcolor: #cacaca"]1[/TD]
[TD="align: left"]Number[/TD]
[TD="align: left"]Last 3 digits[/TD]
[TD="align: left"]<1600000000 AND =840[/TD]
[TD="align: left"]>1600000000 AND =930[/TD]

[TD="bgcolor: #cacaca"]2[/TD]
[TD="align: right"]1335001410[/TD]
[TD="align: right"]410[/TD]

[TD="bgcolor: #cacaca"]3[/TD]
[TD="align: right"]1335003990[/TD]
[TD="align: right"]990[/TD]

[TD="bgcolor: #cacaca"]4[/TD]
[TD="align: right"]1341000930[/TD]
[TD="align: right"]930[/TD]

[TD="bgcolor: #cacaca"]5[/TD]
[TD="align: right"]1341001790[/TD]
[TD="align: right"]790[/TD]

[TD="bgcolor: #cacaca"]6[/TD]
[TD="align: right"]1341001930[/TD]
[TD="align: right"]930[/TD]

[TD="bgcolor: #cacaca"]7[/TD]
[TD="align: right"]1341001990[/TD]
[TD="align: right"]990[/TD]

[TD="bgcolor: #cacaca"]8[/TD]
[TD="align: right"]1341002930[/TD]
[TD="align: right"]930[/TD]

[TD="bgcolor: #cacaca"]9[/TD]
[TD="align: right"]1341002990[/TD]
[TD="align: right"]990[/TD]

[TD="bgcolor: #cacaca"]10[/TD]
[TD="align: right"]1341003930[/TD]
[TD="align: right"]930[/TD]

[TD="bgcolor: #cacaca"]11[/TD]
[TD="align: right"]1841060182[/TD]
[TD="align: right"]182[/TD]

[TD="bgcolor: #cacaca"]12[/TD]
[TD="align: right"]1841060471[/TD]
[TD="align: right"]471[/TD]

[TD="bgcolor: #cacaca"]13[/TD]
[TD="align: right"]1842200760[/TD]
[TD="align: right"]760[/TD]

[TD="bgcolor: #cacaca"]14[/TD]
[TD="align: right"]1842201840[/TD]
[TD="align: right"]840[/TD]

[TD="bgcolor: #cacaca"]15[/TD]
[TD="align: right"]1842202841[/TD]
[TD="align: right"]841[/TD]

[TD="bgcolor: #cacaca"]16[/TD]
[TD="align: right"]1842203840[/TD]
[TD="align: right"]840[/TD]

[TD="bgcolor: #cacaca"]17[/TD]
[TD="align: right"]1842203841[/TD]
[TD="align: right"]841[/TD]

[TD="bgcolor: #cacaca"]18[/TD]
[TD="align: right"]1842205840[/TD]
[TD="align: right"]840[/TD]

[TD="bgcolor: #cacaca"]19[/TD]
[TD="align: right"]1842206840[/TD]
[TD="align: right"]840[/TD]

[TD="bgcolor: #cacaca"]20[/TD]
[TD="align: right"]1842207810[/TD]
[TD="align: right"]810[/TD]

</tbody>

ZelleFormel
B2=--RIGHT([@Number],3)
C2=AND([@Number]<1600000000,[@[Last 3 digits]]=840)
D2=AND([@Number]>1600000000,[@[Last 3 digits]]=930)

<tbody>
</tbody>
Verwendete Systemkomponenten: [Windows (32-bit) NT 6.01] MS Excel 2016
Diese Tabelle wurde mit Tab2Html (v2.6.0) erstellt. ©Gerd alias Bamberg

<tbody>
</tbody>

FALSCH is german for FALSE.
No number meets your criteria.

view
view

it looks o.k. to me.
view

https://drive.google.com/file/d/1y-k2pdSEKC1IkSgFxQuqufxmsEyqZ4KO/view?usp=sharing
 
Upvote 0
A

<colgroup><col style="width: 25pxpx"><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]2[/TD]
[TD="align: right"]1335001410[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]1335003990[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]1341000930[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]1341001790[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]1341001930[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]1341001990[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]1341002930[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]1341002990[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]1341003930[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]1841060182[/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]1841060471[/TD]

[TD="align: center"]13[/TD]
[TD="align: right"]1842200760[/TD]

[TD="align: center"]14[/TD]
[TD="align: right"]1842201840[/TD]

[TD="align: center"]15[/TD]
[TD="align: right"]1842202841[/TD]

[TD="align: center"]16[/TD]
[TD="align: right"]1842203840[/TD]

[TD="align: center"]17[/TD]
[TD="align: right"]1842203841[/TD]

[TD="align: center"]18[/TD]
[TD="align: right"]1842205840[/TD]

[TD="align: center"]19[/TD]
[TD="align: right"]1842206840[/TD]

[TD="align: center"]20[/TD]
[TD="align: right"]1842207810[/TD]

</tbody>
2174

A

<colgroup><col style="width: 25pxpx"><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: right"]1600000000[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]930[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]840[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]8[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]1341000930[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]1341001930[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]1341002930[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]1341003930[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]1842201840[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]1842203840[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]1842205840[/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]1842206840[/TD]

</tbody>
main

shift-del is right. We need to change the 1600000000 test in accordance with the results you want to obtain.


In A4 of main control+shift+enter, not just enter:

=SUM(IF('2174'!A2:A20<a1,if(right('2174'!a2:a20,3)+0=a2,1))+if('2174'!a2:a20>A1,IF(RIGHT('2174'!A2:A20,3)+0=A3,1)))

In A5 of main control+shift+enter, not just enter, and copy down:

=IF(ROWS($A$5:A5)>$A$4,"",INDEX('2174'!$A$2:$A$20,SMALL(IF(('2174'!$A$2:$A$20 < $A$1)*(RIGHT('2174'!$A$2:$A$20,3)+0=$A$2)+('2174'!$A$2:$A$20 > $A$1)*(RIGHT('2174'!$A$2:$A$20,3)+0=$A$3),ROW('2174'!$A$2:$A$20)-ROW(INDEX('2174'!$A$2:$A$20,1,1))+1),ROWS($A$5:A5))))


Thank you
i got an error in:
=SUM(IF('2174'!A2:A20<a1,if(right('2174'!a2:a20,3)+0=a2,1))+if('2174'!a2:a20>A1,IF(RIGHT('2174'!A2:A20,3)+0=A3,1)))

when i have trid to add "," A20,A1 i get [TABLE="width: 112"]
<tbody>[TR]
[TD="width: 112, align: right"]304000000[/TD]
[/TR]
</tbody>[/TABLE]

the condition should be =OR(AND(B2<1600000000,VALUE(RIGHT(B2,3))=930),AND(B2>1600000000,VALUE(RIGHT(B2,3))=840))

can i do it in one cell (the table starts with a1 title, a2 data).

I have tried to do it like:
=IF(ROWS($A$5:A5)>$A$4,"",INDEX('2174'!A:A,SMALL(IF(('2174'!A:A < $A$1)*(RIGHT('2174'!A:A,3)+0=$A$2)+('2174'!A:A > $A$1)*(RIGHT('2174'!A:A,3)+0=$A$3),ROW('2174'!A:A)-ROW(INDEX('2174'!A:A,1,1))+1),ROWS($A$5:A5))))

with control+shift+enter



</a1,if(right('2174'!a2:a20,3)+0=a2,1))+if('2174'!a2:a20></a1,if(right('2174'!a2:a20,3)+0=a2,1))+if('2174'!a2:a20>
 
Upvote 0
If you are familiar with Power Query then you can use this M-Code.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="tbl_Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Number", Int64.Type}}),
    #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Number", "Number - Kopie"),
    #"Extracted Last Characters" = Table.TransformColumns(#"Duplicated Column", {{"Number - Kopie", each Text.End(Text.From(_, "de-DE"), 3), type text}}),
    #"Renamed Columns" = Table.RenameColumns(#"Extracted Last Characters",{{"Number - Kopie", "Last 3 digits"}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"Last 3 digits", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type1", each [Number] > 1600000000 and [Last 3 digits] = 840 or [Number] < 1600000000 and [Last 3 digits] = 930),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Last 3 digits"})
in
    #"Removed Columns"

Adapt Name="tbl_Data" to your need.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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