Tricky Mod Function

duckinbath

New Member
Joined
Apr 1, 2011
Messages
5
I need to create a new columin my work sheet using a mod function that sorts the last digit of a number. I cannot use Excel Sort or Filter the column looks like this except much longer. The last digit I'm trying to filter is 3.
<TABLE style="WIDTH: 48pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=64><COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 15pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl67 height=20 width=64>1110001</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 15pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl67 height=20 width=64>1110002</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 15pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl67 height=20 width=64>1110003</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 15pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl67 height=20 width=64>1110004</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 15pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl67 height=20 width=64>1110005</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 15pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl67 height=20 width=64>1110006</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 15pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl67 height=20 width=64>1110007</TD></TR></TBODY></TABLE>
I would appreciate any help thank you.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
yeah there is only one 3 in my previous posts but I only posted a few of the ID's there are 357 ID's that I need to sort through.

If you just want to flag them...

D2:

=(RIGHT(A2)+0=3)+0

would yield a 1 for a hit, a 0 for a miss.

Note that using MOD you would get all ID's with 0 or a multiple of 3
as last digit. Just try the following to see that:

D2:

=(MOD(RIGHT(A2)+0,3)=0)+0

Again: 1 for a hit, 0 for a miss.

Note. If you want to list all records where ID's end in 3
in a separate result area, a different approach is needed.
 
Upvote 0
ID nos in col E
F1 =IF(VALUE(RIGHT(E1,1))=3,ROW(),"") copy down list
G1 =INDEX(E:E,MATCH(SMALL(F:F,ROW(F1)),F:F,0)) copy down until NUM error appears

HTH
 
Upvote 0
ID nos in col E
F1 =IF(VALUE(RIGHT(E1,1))=3,ROW(),"") copy down list
G1 =INDEX(E:E,MATCH(SMALL(F:F,ROW(F1)),F:F,0)) copy down until NUM error appears

HTH
Your use of the ROW function in column G is risky. If the user decides, say, to add a new heading row by inserting a new row 1 after your formula have been added, your list will lose the first entry.

If using a helper column to make the list, this would be more robust. It also copes with ending the list neatly. E1 houses a 0. E2 and G2 copied down.

Excel Workbook
ABCDEFG
1StudentIDExamVersion3List
211100011A01110003
311100021C01110863
411100031A11110893
511100041A1
611108631A2
711108931A3
811100071A3
9
List
 
Upvote 0
Your use of the ROW function in column G is risky. If the user decides, say, to add a new heading row by inserting a new row 1 after your formula have been added, your list will lose the first entry.

If using a helper column to make the list, this would be more robust. It also copes with ending the list neatly. E1 houses a 0. E2 and G2 copied down.

Excel Workbook
ABCDEFG
1StudentIDExamVersion3List
211100011A01110003
311100021C01110863
411100031A11110893
511100041A1
611108631A2
711108931A3
811100071A3
9
List
Sorry about delay in replying, other matters pressing but thank you for your solution. I've never used ROWS before but will keep in mind for later usage. Also usually use an IF(ISERROR( statement to blank out #NUM! values in lists but didn't this time.

As you can see I'm a newbie to this forum and am still feeling my way around. Thanks again>
 
Upvote 0

Forum statistics

Threads
1,224,567
Messages
6,179,571
Members
452,927
Latest member
whitfieldcraig

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