ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   indicate a missing number in a sequence (https://www.excelbanter.com/excel-discussion-misc-queries/72983-indicate-missing-number-sequence.html)

mmock

indicate a missing number in a sequence
 
Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


Bob Phillips

indicate a missing number in a sequence
 
You cannot flag the ones that are missing! I was going to suggest flagging
all those around the missing using conditional formatting and this formula

=NOT(AND(OR(A1=MAX($A$1:$C$3),COUNTIF($A$1:$C$3,A1 +1)0),OR(A1=MIN($A$1:$C$3
),COUNTIF($A$1:$C$3,A1-1)0))(

but it shows more than 14 and 17 as lots more are missing.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"mmock" wrote in message
...
Prior to sending this post, I have read many posts and have not quite

found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a

ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark




Toppers

indicate a missing number in a sequence
 
Hi,
Try this which lists missing values in column D. "UsedRange" is
assumed to be Columns A to C with data starting in row 2 (row 1 is header):

Sub CheckSequence(ByVal rng As Range)

Dim v As Variant
Dim r As Long, c As Integer
MsgBox rng.Address
v = rng
For r = 3 To UBound(v, 1) <=== change 3 to 2 if no header row

If v(r, 1) < v(r - 1, 2) + 1 Then
Stra = ""
For i = v(r - 1, 2) + 1 To v(r, 1) - 1
Stra = Stra + Trim(Str(i)) & ","
Next i
Stra = Left(Stra, Len(Stra) - 1)
rng(r, 4) = Stra
End If
Next r


Sub mytest()
CheckSequence ActiveSheet.UsedRange '<=== Change range if required
End Sub
"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


Gary''s Student

indicate a missing number in a sequence
 
For no missing data A9 should equal B8 plus one:


In D1 put:
=IF(A2=B1+1,"","ERROR") and copy down the column. This won't tell you
what's missing, but it will tell you that something is missing.
--
Gary''s Student


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


mmock

indicate a missing number in a sequence
 
HI Gary:

I tried your suggestion and found that it errored for everything. Using the
example I listed, it gives me an error even though there are no missing
numbers (or tickets)
M.




"Gary''s Student" wrote:

For no missing data A9 should equal B8 plus one:


In D1 put:
=IF(A2=B1+1,"","ERROR") and copy down the column. This won't tell you
what's missing, but it will tell you that something is missing.
--
Gary''s Student


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


mmock

indicate a missing number in a sequence
 
Hi Toppers:

Maybe I'm reading too much into this but your answer is appearing too
technical for me. Can you make it more user friendly?
thanks,
M.


"Toppers" wrote:

Hi,
Try this which lists missing values in column D. "UsedRange" is
assumed to be Columns A to C with data starting in row 2 (row 1 is header):

Sub CheckSequence(ByVal rng As Range)

Dim v As Variant
Dim r As Long, c As Integer
MsgBox rng.Address
v = rng
For r = 3 To UBound(v, 1) <=== change 3 to 2 if no header row

If v(r, 1) < v(r - 1, 2) + 1 Then
Stra = ""
For i = v(r - 1, 2) + 1 To v(r, 1) - 1
Stra = Stra + Trim(Str(i)) & ","
Next i
Stra = Left(Stra, Len(Stra) - 1)
rng(r, 4) = Stra
End If
Next r


Sub mytest()
CheckSequence ActiveSheet.UsedRange '<=== Change range if required
End Sub
"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


mmock

indicate a missing number in a sequence
 
Maybe to clarify more. On same days I will use or sell more than one ticket.
Line B1 - A1 = C1 (or 10 tickets sold). Is the +1 used only for when it is
1 above the previous number?
Thanks,
Mark


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


Toppers

indicate a missing number in a sequence
 
I tried Gary's solution with your data as posted and correctly indicated an
"error" i.e. data missing (15,16) in row 3.

"mmock" wrote:

HI Gary:

I tried your suggestion and found that it errored for everything. Using the
example I listed, it gives me an error even though there are no missing
numbers (or tickets)
M.




"Gary''s Student" wrote:

For no missing data A9 should equal B8 plus one:


In D1 put:
=IF(A2=B1+1,"","ERROR") and copy down the column. This won't tell you
what's missing, but it will tell you that something is missing.
--
Gary''s Student


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


Toppers

indicate a missing number in a sequence
 
Shouldn't that be 11 tickets sold (numbers to 1 to 11 inclusive)?

"mmock" wrote:

Maybe to clarify more. On same days I will use or sell more than one ticket.
Line B1 - A1 = C1 (or 10 tickets sold). Is the +1 used only for when it is
1 above the previous number?
Thanks,
Mark


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


mmock

indicate a missing number in a sequence
 
You are correct......thank you again, I would have another ticket missing!!

"Toppers" wrote:

Shouldn't that be 11 tickets sold (numbers to 1 to 11 inclusive)?

"mmock" wrote:

Maybe to clarify more. On same days I will use or sell more than one ticket.
Line B1 - A1 = C1 (or 10 tickets sold). Is the +1 used only for when it is
1 above the previous number?
Thanks,
Mark


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


Toppers

indicate a missing number in a sequence
 
Assuming you are happy with Gary's solution, try this modified version which
gives range of missing tickets i.e. 15-16 in your example in row 3:

=IF(A2=B1+1,"", B1+1 & "-" & A2-1)

"mmock" wrote:

You are correct......thank you again, I would have another ticket missing!!

"Toppers" wrote:

Shouldn't that be 11 tickets sold (numbers to 1 to 11 inclusive)?

"mmock" wrote:

Maybe to clarify more. On same days I will use or sell more than one ticket.
Line B1 - A1 = C1 (or 10 tickets sold). Is the +1 used only for when it is
1 above the previous number?
Thanks,
Mark


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


mmock

indicate a missing number in a sequence
 
I am happy with the formula and trying to understand it, it does make sence
but I cannot seemt o get it to work for me?

"Toppers" wrote:

Assuming you are happy with Gary's solution, try this modified version which
gives range of missing tickets i.e. 15-16 in your example in row 3:

=IF(A2=B1+1,"", B1+1 & "-" & A2-1)

"mmock" wrote:

You are correct......thank you again, I would have another ticket missing!!

"Toppers" wrote:

Shouldn't that be 11 tickets sold (numbers to 1 to 11 inclusive)?

"mmock" wrote:

Maybe to clarify more. On same days I will use or sell more than one ticket.
Line B1 - A1 = C1 (or 10 tickets sold). Is the +1 used only for when it is
1 above the previous number?
Thanks,
Mark


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


mmock

indicate a missing number in a sequence
 
I GOT IT!!

I was using the worng cell numbers!! Both Gary's original version and the
MODIFIED version is PERFECT.

Thank you all for you assistance!
Mark


"mmock" wrote:

I am happy with the formula and trying to understand it, it does make sence
but I cannot seemt o get it to work for me?

"Toppers" wrote:

Assuming you are happy with Gary's solution, try this modified version which
gives range of missing tickets i.e. 15-16 in your example in row 3:

=IF(A2=B1+1,"", B1+1 & "-" & A2-1)

"mmock" wrote:

You are correct......thank you again, I would have another ticket missing!!

"Toppers" wrote:

Shouldn't that be 11 tickets sold (numbers to 1 to 11 inclusive)?

"mmock" wrote:

Maybe to clarify more. On same days I will use or sell more than one ticket.
Line B1 - A1 = C1 (or 10 tickets sold). Is the +1 used only for when it is
1 above the previous number?
Thanks,
Mark


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark


mmock

indicate a missing number in a sequence
 
Thank you for your help with this. I would like to add one twist. Is there
a way to limit the number to 500? The tickets come in booklets of 500 and I
do not need the formula to go higher than this.

Thanks again.

"Toppers" wrote:

Assuming you are happy with Gary's solution, try this modified version which
gives range of missing tickets i.e. 15-16 in your example in row 3:

=IF(A2=B1+1,"", B1+1 & "-" & A2-1)

"mmock" wrote:

You are correct......thank you again, I would have another ticket missing!!

"Toppers" wrote:

Shouldn't that be 11 tickets sold (numbers to 1 to 11 inclusive)?

"mmock" wrote:

Maybe to clarify more. On same days I will use or sell more than one ticket.
Line B1 - A1 = C1 (or 10 tickets sold). Is the +1 used only for when it is
1 above the previous number?
Thanks,
Mark


"mmock" wrote:

Prior to sending this post, I have read many posts and have not quite found
the answer I am looking for. I hope someone can help me with a formula.

I need to track tickets used. More importantly, I need to know if a ticket
in a sequence is missing. I will be tracking start & stop numbers and
tickets used. I'm looking for an indicator of some sort to tell me when a
ticket is missing or out of sequence.
Example

A1=1 B1=11 C1=10
A2=12 B2=14 C2=2
A3=17 B3=20 C3=3 (FLAG the 2 missing tickets 15 & 16)

Any assistance would be apprciated.
thanks,
Mark



All times are GMT +1. The time now is 05:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com