# UDF - Find Consecutive Numbers In Single Cell With Dash

Mar 14, 2014
I need find consecutive Numbers in a singles Cell but each numbers have a leading zero and "-" (Dash)

My problem is that the UDF that i found on this forum, is for numbers with out leading zero with comma ",",

So even if change the "," by "-", still getting a error Because the Code is designed to Read numbers Formats different than mine..

My Numbers are located in Cell G12 (down), and the message that i need to show in the cell result is :

If Found :

0 Consecutives --> 0

2 Consecutives --> 2

3 consecutives --> 3

4 consecutives --> 4

5 consecutives --> 5

2 Set of consecutives --> 2S

Example of 0 consecutives --> 01-04-07-12-25-30

Example of 2 consecutives --> 01-02-07-12-25-30

Example of 3 consecutives --> 01-02-03-12-25-30

Example of 4 consecutives --> 01-02-03-04-25-30

Example of 5 consecutives --> 01-02-03-04-05-30

Example of 2 sets of consecutive s --> 01-02-07-12-25-26

BTW my numbers start on Cell G12 down..

______G12_______

01-02-03-20-21-25

View 11 Replies
ADVERTISEMENT
Jun 5, 2008

I have set up a spreadsheet template that automatically populates specific values through the spreadsheet based on what the value of cell "A1" is. I want to run through 224 potential values in cell A1 and print out the worksheet after each potential value.

My thought on how to approach it is to write a macro that:

1. Selects the next item from the drop down box in cell A1

2. Prints the page (using default print settings)

3. Loops

But I don't know what the code would be. Cell A1 also does not need to be a drop down box, as long as it incrementally runs through all 224 listed values and prints after each one.

View 6 Replies
View Related
Oct 28, 2009

I have a row of 2900 single letter (middle initals) however 222 users have no middle inital. this is a password scheme and need 7 digits, without the middle inital i only have 6. so I want to replace all 222 cell that are blank with a dash can this be done without doing each by hand?

View 4 Replies
View Related
Aug 18, 2009

Column C is the tricky one. It comes from the bank and somewhere in there is a 4-digit tenant reference. I did a formula to try and isloate it and it worked on most but if you look at the very first row, there is a spurious 99 in there, so it didn't work. Is there a way of EXTRACTING the first four consecutive numbers and placing them in another cell?

View 14 Replies
View Related
Feb 26, 2009

Here is what my worksheets looks like.

54841

54841-1

54841-2

54841-3

55654

58850

58850-1

53254

53254-1

53254-2

56696

56696-3

56696-4

53214

54789

So this list of information needs to be changed to the following

54841

54841-1

54841-2

54841-3

55654

58850

58850-1

53254

53254-1

53254-2

56696

56696-3

56696-4

53214

54789

All the numbers in red need to be cleared. No I have been able to find the original number and clear it. For example I can have the program find 53254 and clear it, but I am really having a tough time having it find -1, -2, -3 and so on. If the program finds a -1, I need any dashes after that to be cleared. If the program doesn't find a -1, then it goes to -2. If it finds a -2 then any number after that needs to be cleared. Here is the code I have to clear some of the numbers.

View 4 Replies
View Related
Aug 15, 2013

I have a column of data that may or may not have a formula in them. The cells are formatted in Accounting, w/o the leading $ sign. (i.e. 133.57) The value zero shows up as a hyphen or dash.

The issue is the format of the cell. In that attached worksheet, i inserted two formulas in cell b6 and b7. Both formulas are exactly the same, but the formatting is different. One is in the accounting format, but the other is in general. When I run the code, only the general formatted cell gets found.

My real worksheet is in the accounting formatted code, so I don't want to change my worksheet's numbers into a general format. How I can find the zero value thats in an accounting format?

Below is a strip down version of the code.

VB:

Sub test()[COLOR=#333333]

[/COLOR] Dim rLookInADR As Range

Dim foundcell As Range

Set rLookInADR = Range("b1:b380")

Set foundcell = rLookInADR.Find(what:=0, LookIn:=xlValues, lookat:=xlWhole)

MsgBox (foundcell.Row)

End Sub

[COLOR=#333333][/COLOR]

View 5 Replies
View Related
Feb 21, 2014

I have a macro already that prints my blank invoices sequentially. What I would now like to do, is insert a dash. SO instead of just the invoice number, I would like to have a 1- in front of each number;

1-1

1-2

1-3

1-4 ... etc.

I have uploaded the 'invoice' that I am currently using.

View 6 Replies
View Related
Jan 8, 2010

I'm trying to do is to get Excel to look at the dates and, if they are consecutive (Fri - Mon inclusive is also counted as consecutive) I need Excel to tell me that this is one occasion. It then needs to count each seperate occasion.

I've attached an example with each different occasion colour coded. In the example there a five occasions. Thus the Bradford Factor would be 187.5 (5*5*7.5).

View 2 Replies
View Related
Jun 2, 2014

I couldn't figure out how to change this function to allow for weekends.

Function to count consecutive dates as one occasion

=--((NETWORKDAYS(SUM(c1)*(B1=B2),c2)-1)>1)

Column A Column B Column C Column D ( I would then use this column in a pivot table to calculate)

pat name pat id date of service # Admissions

[code]....

View 4 Replies
View Related
Jan 31, 2013

I have taken over this spreadsheet for my work, and it is basically a statement in excel. What I want to do is find a list of invoice numbers in column B populated from a remittance, and then replace column F to say a specific thing depending on check number and date paying for that invoice. So if a check printed today I would have it replace column f to say paid 1/31/13 check # xxxxx. Currently I am searching for each invoice indivudually and then replacing with check number and date. There are about 200 invoices per month that I deal with, and it is a big waste of time!

For example from this

invoice #1 / reconciled (DATE)

invoice #2 / reconciled (DATE)

To this:

invoice #1 / paid (DATE) check # (xxxxx)

invoice #2 / paid (DATE) check # (xxxxx)

View 2 Replies
View Related
Mar 31, 2009

What is the function to add numbers in a single cell to show only a single number. I know it can be done but do not know the quick function to do it.

View 10 Replies
View Related
Aug 23, 2012

I have a string of numbers like this:

378 398 308 978 397 328 078 307 908 278

And this code works fine except for I get a Type 13 Mismatch error on this line of code:

Code:

x = Application.Transpose(Split(my_cell.Value, " "))

Here is the entire sub:

Code:

Public Sub split_down()

Dim x As Variant

Dim my_range As Range

[Code]....

How can I adjust this for several lines of numbers like this?

378 398 308 978 397 328 078 307 908 278

390 327 928 678 392 907 208 320 927 178

608 394 207 578 391 920 108 607 395 324

508 321 168 107 325 924 568 507 341 921

167 345 925 518 567 351 941 160 945 517

560 951 241 245 510 251 516 451 388 338

788 988 337 088 778 339 377 288 330 998

And what is going on with this error. The first number string above should be placed in cell A1 when trying this code.

View 4 Replies
View Related
Jun 12, 2007

I have problem with function, I have array with random numbers in cell G1 and columns with X in some of the cells, now I want to check the cells with numbers from cell G1 in column F to see is there X or not if yes count if not do nothing. In attached example result should be 3.

View 7 Replies
View Related
Apr 11, 2008

I am trying to write a macro that will select and copy all cells in a row that do not have a zero value.

The data I am trying to select will be contained in 12 cells in a single row, i.e cells A1:L1 and all zero values will always be on the right hand side of the first non-zero value in this row (going left to right), for example:

Row: A B C D E F G H I J K L

(1) 0 0 0 0 1 1 2 2 2 2 2 2

What I want to do here is to select and copy cells E1 to L1, since they are the cells with non-zero values. This can vary, so here there are 8 cells with non-zero values but the next time there might be only 5 cell or all 12 cells, etc. I have a lot of data to sort like this so doing this manually takes a lot of time.

Once the macro has selected and copied the right cells, I will manually paste the data where I need to put it.

The big problem I am having is knowing how to firstly select the appropiate cells.

View 3 Replies
View Related
Jul 9, 2014

As i am working on consolidating the Missing numbers manually, whether will it possible for making this automatic.

In Column "A" I have Multiple Duplicate Invoice Numbers and followed by the Different Transcation numbers in Column "B".

In Column "D" I have Each Invoice Numbers and in Column "E" Total Transaction Numbers i.e., no. of times each Invoice have Transactions.

In Column "F" No. of times we received the Transactions.

Here i need to manually need to update each Invoice's Missing Transaction number in Column "H" in single cell with comma separated to each Missing Transaction numbers.

Example:

Before : (Column "A" & "B")

Invoice NumbersTransaction NumbersInvoice NumbersTotal Transaction NumbersReceived Transaction Numbers

A2014000351501 A201400035150 3 2

A2014000351502 A201400035494 13 12

A2014000354941 A201400035881 12 11

A2014000354942 A201400035884 19 17

A2014000354943 A201400035888 14 13

A2014000354944 A201400037613 5 1

A2014000354945

[Code]...

Instead of doing this manually can we have the VBA to auto Update these missing numbers.

Here by i am attaching sample file.

View 1 Replies
View Related
Aug 15, 2009

I built an Excel Macro to pull information from my schedule and compile it within another Worksheet. The Macro below searches for an instance of "Unavailable" and then populates my Data Worksheet with the WeekDays (ie: M-W-F or ALL Week), the Details (ie: Vacation or Training) and the Name of the employee. I struggled with a way to populate my employee name as "unavailable" isn't always offset by the same amount of characters to employee name (as it is with WeekDays and Details). Instead, I collected the row in which "Unavailable" was found.

I used the Vlookup function to populate the number of Absences and it worked swell.

=VLOOKUP(C2,O:P,2,FALSE)

C2 is populated with Weekdays (ie: ALL week or M-W-F)

O contains a list of possible day combinations

P contains the number of days

I hoped to use a similar function to populate my employee names. This didn't work well a 'tall.

=VLOOKUP(A2,L:M,2,FALSE)....................

View 9 Replies
View Related
Apr 16, 2008

I basically need to grab all the numbers going down in a row and get them into one cell in Text format with a comma between them.

A1

5293

5294

5295

5296

5299

5300

5301

5302

5303

5304

5305

B1

What I need in Text format

5293,5294,5295……

View 3 Replies
View Related
Jul 22, 2008

I have 3 columns, in column 1 and 2 there will be numbers and I want automatically to get in column 3 the range of numbers between Column 1 and Column 2

Column 1 - 100

Column 2 - 500

Column 3 - 100, 101, 102, ..., 500

View 9 Replies
View Related
May 8, 2006

Find Multiple instances of Numeric Criterion in Row & Return To a Single

Column.

I have a Dynamic Named Range "Data" spanning 10 Columns and many Rows.

Each Row may contain duplicates of the Numeric Criterion.

I would like to find ALL instances of a specific Numeric Criterion across

each single Row in the Dynamic Range "Data" and have the Results returned to

a New Sheet in a single column.

NEW Sheet:

The Numeric Criterion is housed in G5.

The matched criterion should be returned to the New Sheet starting at G7.

Duplicate instances in the same Row should ALL be returned to the same cell

in Column G on the New Sheet.

Sample Data Layout:

Columns I J K L M N O P Q R

Row No.76 1 0 1 1 0 1 1 1 0 1

Row No.77 2 2 3 2 1 2 2 0 0 0

Row No.78 3 3 3 3 3 0 3 0 3 0

Scenario:

Looking for Numeric Criterion 1 (one).

Expected Results - New Sheet:

Row No.7 Column G (Cell G7) 1111111

Row No.8 Column G (Cell G8) 1

In Row 76 of the Sample Data ALL seven Numeric Criterion of 1 (one) should be

returned to the same cell G7.

In Row 77 of the Sample Data there is only one Numeric Criterion of 1 and it

should be returned to cell G8.

View 14 Replies
View Related
Mar 24, 2009

I'm a basic excel user really and cannot find a function that will allow me to complete the following:

CELL A1 includes the following sequence of numbers: 1,2,1,0,2,3

I would like to know how to put a formula/function into CELL B1 that sums up the sequence of numbers in CELL A1 (i.e 1+2+1+0+2+3)

View 14 Replies
View Related
Jul 2, 2007

How to copy an entire column having numbers and words on every single cell into another column but only copying numbers, not words.

View 9 Replies
View Related
Jun 24, 2007

I have a daily column of numbers of approx 600 rows and the number is either a 0 or 1 and the 0 or 1 are in a random order in each row like:

1

1

1

0

1

0

0

0

1

0

0

1

I would like to find the min number of rows with 1, the max number of rows with 1, the totals of consecutive rows with 1 ie 3 consecutive rows of 1 appear 4 times, 4 consecutive rows appear 6 times etc and the average of the consecutive rows with 1.

View 9 Replies
View Related
Apr 17, 2014

i have a list of numbers in a column, and i have sorted it smallest to largest, now i wish to identify which ones are consecutive in the column.

5184730512

5184730547

5184730763

5184730766

5184730767

5184730836

5184731135

5184731136

5184731149

5184731212

5184731222

5184731389

View 4 Replies
View Related
Dec 9, 2013

with this Excel problem? I have a set of data of 300 some odd rows of numbers. I need to find 24 CONSECUTIVE values that add up to the HIGHEST sum? For instance,

2

2

0

0

4

2

0

0

1

8

5

2

View 1 Replies
View Related
Jun 24, 2007

I have a daily column of numbers of approx 600 rows and the number is either a 0 or 1 and the 0 or 1 are in a random order in each row like;

1

1

1

0

1

0

0

0

1

0

0

1

I would like to find the min number of rows with 1, the max number of rows with 1, the totals of consecutive rows with 1 ie 3 consecutive rows of 1 appear 4 times, 4 consecutive rows appear 6 times etc and the average of the consecutive rows with 1.

View 5 Replies
View Related
Aug 13, 2008

I am preparing a attendance sheet. I am using 1 & 0 for present(=1) & absent(=0). I want to find out if a student has been absent for three consecutive days and if there is three consecutive 0 then the formula should return the value 0 ( the student gets 0 if he is absent for 3 consecutive days ) otherwise it should add all the 1s in the row. i.e

1 1 1 0 0 1 1 0 = 5

10 0 0 1 1 0 0 = 0

View 5 Replies
View Related
Dec 13, 2013

I have a list of products and would like to find what are the missing products which aren't ordered yet from the customer.

As the example: let's assume numbers from 1 to 9.

And I have some numbers, like this: 2, 4, 6, 7. What is the formula which can copy automatically the missing one into one cell?

See the attachment : howtodothis.xls

I know, how to copy multiple cell into one cell (like A4&", "&", "A5 etc), but how to find the missing numbers?

View 8 Replies
View Related
Sep 29, 2007

I have a macro which scans column "AV" in Sheet1 and if a particular value is found it will copy certain cells from that row and paste them into Sheet2 on Row 10 starting with column "E".

With the current code I only paste a single instance, if the value is found more than once I only have the last one pasted. How can I best set this up so it will paste ALL found value results within Row 10?

The four copied results do not have to be in separate cells, it is actually best if the cells are combined. On Sheet2, cells E10-H10 can also be setup to have the data pasted across all four cells and that way Row Height AutoFit would take care of expanding the row's height to accommodate the possibly of having four or five sets of results being combined together and pasted into E10.

Rather than the typical result appearing as:

[TABLE]______E___F___G___H

10__1223 122 2222 2222

11__343 565 4554 5990

12__9755 334 6787 6788[/TABLE]

It is better for me if the data appears like this:

[TABLE]_____E____F____G____H

____1223 122 2222 2222, 343

10__565 4554 5990, 9755 334

____6787 6788

[/TABLE]

Is this even possible using a macro? It is currently being done using a Word document but I am wanting to automate the process and try to handle all the data sorting within Excel, if possible.

Sub Number()

Dim colSearch As Range

Dim celVal As Range

Dim celRow As Range

With Sheets("Sheet1")

View 9 Replies
View Related
Sep 28, 2012

I need a formula that will count the number of consecutive 3 0's from the following Data series. There are 22 such events.

0

6

15

[Code].....

View 9 Replies
View Related
Jan 14, 2014

I have the attached table of numbers and I need a formula at the end of each column to identify whether any cells in that column consecutively have numbers in them greater than zero. Ideally by a count of how many cells in the column have consecutive numbers greater than zero (so if there are three 1's in a row and then a zero and then another 2 1's I want it to count 5).Excel Help.xlsx

View 2 Replies
View Related