Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Find missing values in a series

I have a column with transaction numbers which are non unique values, but
some values are missing

1
1
2
2
2
4
4
5
5
6
6
6
8
8
.....
10000

I want to output a list of the missing values:
3
7
.....
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Find missing values in a series

I want to add, and it is not clear from my example, that the values are not
sorted, however, all the entries with the same value are together, i.e. the
column can look like this:

1
1
1
3
3
3
....
45
45
2
2
....
"petermcwerner" wrote:

I have a column with transaction numbers which are non unique values, but
some values are missing

1
1
2
2
2
4
4
5
5
6
6
6
8
8
....
10000

I want to output a list of the missing values:
3
7
....

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 136
Default Find missing values in a series

Hello,

If your values are in A1:A99 then enter as array formula:
=multicat(IF(ISNA(MATCH(ROW(INDIRECT("1:"&MAX(A1:A 99))),A1:A99,)),ROW(INDIRECT("1:"&MAX(A1:A99)))&", ",""))

The UDF multicat you have to copy into a module (press ALT + F11,
insert a module and then insert code shown below):
'********************************************
'Purpose: Concatenate all cells in a range or
' array
'Inputs: vP - range/array to be concatenated
' sDelim - optional delimiter to be
' inserted between text parts
'Returns: Concatenated string
'*****************************************
Function MultiCat( _
ByRef vP As Variant, _
Optional ByVal sDelim As String = "") _
As String
Dim vE As Variant
For Each vE In vP
MultiCat = MultiCat & sDelim & vE
Next vE
MultiCat = Mid(MultiCat, Len(sDelim) + 1)
End Function

Regards,
Bernd

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Find missing values in a series

Hello,Sir Bernd,

calculation time is worth of it and this multicat function is good, yet is
there any way to have a final result something like this

{3,6,7,8,10}

i've made a few run on it and have a result of
3,6,7,8,10,

i need it as part of a lookup..if you can please

best regards,
driller

" wrote:

Hello,

If your values are in A1:A99 then enter as array formula:
=multicat(IF(ISNA(MATCH(ROW(INDIRECT("1:"&MAX(A1:A 99))),A1:A99,)),ROW(INDIRECT("1:"&MAX(A1:A99)))&", ",""))

The UDF multicat you have to copy into a module (press ALT + F11,
insert a module and then insert code shown below):
'********************************************
'Purpose: Concatenate all cells in a range or
' array
'Inputs: vP - range/array to be concatenated
' sDelim - optional delimiter to be
' inserted between text parts
'Returns: Concatenated string
'*****************************************
Function MultiCat( _
ByRef vP As Variant, _
Optional ByVal sDelim As String = "") _
As String
Dim vE As Variant
For Each vE In vP
MultiCat = MultiCat & sDelim & vE
Next vE
MultiCat = Mid(MultiCat, Len(sDelim) + 1)
End Function

Regards,
Bernd


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 136
Default Find missing values in a series

Hello,

Then select a vertical array of cells of sufficient size and enter as
array formula:
=TRANSPOSE(ReturnNonEmpty(IF(ISNA(MATCH(ROW(INDIRE CT("1:"&MAX(A1:A99))),A1:A99,)),ROW(INDIRECT("1:"& MAX(A1:A99))),"")))

[you should omit TRANSPOSE if you take a horizontal array]

Insert the following UDF:
Function ReturnNonEmpty( _
ByRef vP As Variant) As Variant
Dim vE As Variant
Dim i As Long

ReDim vR(1 To UBound(vP)) As Variant
i = 0
For Each vE In vP
If Len(vE) 0 Then
i = i + 1
vR(i) = vE
End If
Next vE
ReDim Preserve vR(1 To i) As Variant
ReturnNonEmpty = vR
End Function

Please notice that in case of only 1 gap you get that value in all
cells of your result array. And, if there is no gap at all, error
values will appear.

Regards,
Bernd



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Find missing values in a series

can u give one more and it mayBE my last,

i need only want to get the result if
a) one integer is missing between the 2 immediate integer
b) the integer is on this series (1,8,15,22) of 7's.

(e.g)

1
2
2
4
10
10
12
15

result is {3,7,11,14} in sequence,

gracias with thanks...
driller

" wrote:

Hello,

Then select a vertical array of cells of sufficient size and enter as
array formula:
=TRANSPOSE(ReturnNonEmpty(IF(ISNA(MATCH(ROW(INDIRE CT("1:"&MAX(A1:A99))),A1:A99,)),ROW(INDIRECT("1:"& MAX(A1:A99))),"")))

[you should omit TRANSPOSE if you take a horizontal array]

Insert the following UDF:
Function ReturnNonEmpty( _
ByRef vP As Variant) As Variant
Dim vE As Variant
Dim i As Long

ReDim vR(1 To UBound(vP)) As Variant
i = 0
For Each vE In vP
If Len(vE) 0 Then
i = i + 1
vR(i) = vE
End If
Next vE
ReDim Preserve vR(1 To i) As Variant
ReturnNonEmpty = vR
End Function

Please notice that in case of only 1 gap you get that value in all
cells of your result array. And, if there is no gap at all, error
values will appear.

Regards,
Bernd


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Find missing values in a series

Hello Bernd,

Thank you for your answer. I have tried to copy and paste your formula and
codes but I only get a "#VALUE!" error message. I must have done something
wrong, as it is the first time I work with a UDF in Excel. Just to give you
an idea of my capabilitîes to understand: I am a CPP programmer but utterly
ignorant of vBasic. I therefore shall explain step by step what I did and
hope you can find and point out my mistake.

1) The range of my values is B5:B1314

2) I copied the The UDF multicat without any modification as you instructed

3) In Cell C6 (of an empty coloumn C) I copied your formula, modified as
follows:
=multicat(IF(ISNA(MATCH(ROW(INDIRECT("1:"&MAX(B5:B 1314))),B5:B1314,)),ROW(INDIRECT("1:"&MAX(B5:B1314 )))&",",""))

Can you see from these data what is wrong?

Thank you, best regards
Peter

" wrote:

Hello,

If your values are in A1:A99 then enter as array formula:
=multicat(IF(ISNA(MATCH(ROW(INDIRECT("1:"&MAX(A1:A 99))),A1:A99,)),ROW(INDIRECT("1:"&MAX(A1:A99)))&", ",""))

The UDF multicat you have to copy into a module (press ALT + F11,
insert a module and then insert code shown below):
'********************************************
'Purpose: Concatenate all cells in a range or
' array
'Inputs: vP - range/array to be concatenated
' sDelim - optional delimiter to be
' inserted between text parts
'Returns: Concatenated string
'*****************************************
Function MultiCat( _
ByRef vP As Variant, _
Optional ByVal sDelim As String = "") _
As String
Dim vE As Variant
For Each vE In vP
MultiCat = MultiCat & sDelim & vE
Next vE
MultiCat = Mid(MultiCat, Len(sDelim) + 1)
End Function

Regards,
Bernd


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 136
Default Find missing values in a series

Hello Peter,

1. Did you enter the formula as array formula (finally press CTRL +
SHIFT + ENTER, not only ENTER!)?

2. Sometimes ominous minuses ("-") are added into long lines of code
here. Please check whether there is any unwanted "-" in your worksheet
or your VBA code.

Does it work now?

If not send me a mail. I can send you my sample file then.

Regards,
Bernd

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Find missing values in a series

Hello Bernd,
Working now, thank you very much
Best regards
Peter

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
where to put results of find operation in find and replace functio DEP Excel Worksheet Functions 5 November 15th 06 07:52 PM
A Macro to find missing serial numbers in a column Khoshravan Excel Discussion (Misc queries) 9 August 6th 06 10:37 AM
find largest values, then return corresponding row values. neurotypical Excel Discussion (Misc queries) 7 May 24th 06 10:27 PM
Find which values sum up another vaule, please help! samsg Excel Discussion (Misc queries) 0 February 27th 06 12:18 AM
ignore missing values while ploting graph Excel plot Excel Discussion (Misc queries) 2 September 15th 05 06:48 PM


All times are GMT +1. The time now is 08:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"