Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Finding right-most cell.

Posted: Tue Sep 27, 2011 1:04 am Post subject: Find right-most
byte

--------------------------------------------------------------------------------

My text file has 1 million rows each 1,274 characters long.

How can I find the row having the number 9 in the right-most cell?

For example, how do I find the row indicated with an arrow?

0000000000000000000009999900000
0000000099999000000000000000000
9999000000000000000000000000000
0000000000000000000000000999900 <----------------------
0000000000000099999990000000000
0000000000000000000000000000000
0000000000000000099999900000000
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Finding right-most cell.

gcotterl formulated the question :
Posted: Tue Sep 27, 2011 1:04 am Post subject: Find right-most
byte

--------------------------------------------------------------------------------

My text file has 1 million rows each 1,274 characters long.

How can I find the row having the number 9 in the right-most cell?

For example, how do I find the row indicated with an arrow?

0000000000000000000009999900000
0000000099999000000000000000000
9999000000000000000000000000000
0000000000000000000000000999900 <----------------------
0000000000000099999990000000000
0000000000000000000000000000000
0000000000000000099999900000000


================================================
Public Sub DetectingRightmost9()
Dim i As Range, MaxRightPos As Long, RowNumber As Long

For Each i In Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
If InStrRev(i, 9) MaxRightPos Then
MaxRightPos = InStrRev(i, 9)
RowNumber = i.Row
End If
Next
MsgBox "Position " & MaxRightPos & " at Row " & RowNumber

End Sub
======================================

Bruno


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Finding right-most cell.

On Mon, 26 Sep 2011 18:38:19 -0700 (PDT), gcotterl wrote:

Posted: Tue Sep 27, 2011 1:04 am Post subject: Find right-most
byte

--------------------------------------------------------------------------------

My text file has 1 million rows each 1,274 characters long.

How can I find the row having the number 9 in the right-most cell?

For example, how do I find the row indicated with an arrow?

0000000000000000000009999900000
0000000099999000000000000000000
9999000000000000000000000000000
0000000000000000000000000999900 <----------------------
0000000000000099999990000000000
0000000000000000000000000000000
0000000000000000099999900000000


What do you mean by a "row each 1,274 characters long"?

Do you mean that each row has 1,274 cells, each with a single character?

Or do you mean that only one cell in each row is of concern, and each of those cells has 1,274 characters?

Or do you mean something else?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Finding right-most cell.


Didn't I answer this in another post which you could have modified to
NOT trim

Sub deleterightzerosSAS() 'assumes TEXT formatting
For Each c In _
Range("a1:a" & Cells(Rows.Count, 1).End(xlUp).Row)
c.Value = Left(c, InStrRev(c, 9))
If Len(c) lenc Then
maxrow = c.Row
lenc = Len(c)
End If
Next c
MsgBox "max " & lenc & " found at row " & maxrow
End Sub





On Sep 27, 9:46*am, Bruno Campanini wrote:
gcotterl formulated the question :









Posted: Tue Sep 27, 2011 1:04 am * *Post subject: Find right-most
byte


--------------------------------------------------------------------------- -----


My text file has 1 million rows each 1,274 characters long.


How can I find the row having the number 9 in the right-most cell?


For example, how do I find the row indicated with an arrow?


0000000000000000000009999900000
0000000099999000000000000000000
9999000000000000000000000000000
0000000000000000000000000999900 *<----------------------
0000000000000099999990000000000
0000000000000000000000000000000
0000000000000000099999900000000


================================================
Public Sub DetectingRightmost9()
Dim i As Range, MaxRightPos As Long, RowNumber As Long

For Each i In Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
* * If InStrRev(i, 9) MaxRightPos Then
* * * * MaxRightPos = InStrRev(i, 9)
* * * * RowNumber = i.Row
* * End If
Next
MsgBox "Position " & MaxRightPos & " at Row " & RowNumber

End Sub
======================================

Bruno





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Finding right-most cell.

On Sep 27, 1:17*pm, Ron Rosenfeld wrote:
On Mon, 26 Sep 2011 18:38:19 -0700 (PDT), gcotterl wrote:
Posted: Tue Sep 27, 2011 1:04 am * *Post subject: Find right-most
byte


--------------------------------------------------------------------------*------


My text file has 1 million rows each 1,274 characters long.


How can I find the row having the number 9 in the right-most cell?


For example, how do I find the row indicated with an arrow?


0000000000000000000009999900000
0000000099999000000000000000000
9999000000000000000000000000000
0000000000000000000000000999900 *<----------------------
0000000000000099999990000000000
0000000000000000000000000000000
0000000000000000099999900000000


What do you mean by a "row each 1,274 characters long"?

Do you mean that each row has 1,274 cells, each with a single character?

Or do you mean that only one cell in each row is of concern, and each of those cells has 1,274 characters?

Or do you mean something else?- Hide quoted text -

- Show quoted text -


Each row has one and that cell has 1,274 characters.

My question simplified: How can I delete the zeroes after the last 9
in each row?


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Finding right-most cell.

On Thu, 29 Sep 2011 05:44:41 -0700 (PDT), gcotterl wrote:

Each row has one and that cell has 1,274 characters.

My question simplified: How can I delete the zeroes after the last 9
in each row?



Expanding on my answer from your other thread

=LEFT(A1,LOOKUP(2,1/(MID(A1,ROW(INDIRECT("1:1274")),1)="9"),ROW(INDIRE CT("1:1274"))))

should do it. The "1274" can be any number at least as long as the longest string, and not greater than the maximum number of rows in your worksheet (e.g. 65536 or 1048576 depending on your version of Excel).

What result do you want if there is no "9" in the string? As written, the above formula will return an error. And what version of Excel are you using?
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Finding right-most cell.

hi,

Sub test1()
For Each c In Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
For y = Len(c) To 1 Step -1
If Mid(c, y, 1) = 9 Then Range(c.Address) = "'" & Left(c, y): Exit For
Next
Next
End Sub


--
isabelle

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 230
Default Finding right-most cell.

On 29/09/2011 13:44, gcotterl wrote:
On Sep 27, 1:17 pm, Ron wrote:
On Mon, 26 Sep 2011 18:38:19 -0700 (PDT), wrote:
Posted: Tue Sep 27, 2011 1:04 am Post subject: Find right-most
byte


--------------------------------------------------------------------------*------


My text file has 1 million rows each 1,274 characters long.


How can I find the row having the number 9 in the right-most cell?


For example, how do I find the row indicated with an arrow?


0000000000000000000009999900000
0000000099999000000000000000000
9999000000000000000000000000000
0000000000000000000000000999900<----------------------
0000000000000099999990000000000
0000000000000000000000000000000
0000000000000000099999900000000


What do you mean by a "row each 1,274 characters long"?

Do you mean that each row has 1,274 cells, each with a single character?

Or do you mean that only one cell in each row is of concern, and each of those cells has 1,274 characters?

Or do you mean something else?- Hide quoted text -

- Show quoted text -


Each row has one and that cell has 1,274 characters.

My question simplified: How can I delete the zeroes after the last 9
in each row?


Doesn't simplify it.

Closest to doing what you want is where source data is in A
Enter in column B

=FIND("9", A1, C$1) and copy down the full extent of the data

Then in C1 enter =1
And in C2 enter =MAX(IF(ISNUMBER(b1..b999, b1..b999,0)))
And in C3 enter =MATCH(C2, b1:b999,0)
entered as an array formula with crtl-shift

Manually adjust C1 based on the feedback in C2 until C1=C2 or C2=0

What a strange thing to want to do!

Regards,
Martin Brown



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
finding last non-blank cell and then copying it to the next cell mike_vr Excel Discussion (Misc queries) 0 January 17th 08 05:02 PM
Finding last cell Jim[_2_] Excel Worksheet Functions 15 February 17th 07 07:45 PM
Finding Cell Interior Colour of First Cell in Column ExcelMonkey[_190_] Excel Programming 4 March 22nd 05 03:01 AM
finding a cell rbekka33[_18_] Excel Programming 0 September 23rd 04 10:25 AM
Finding a cell Alan Excel Programming 5 July 22nd 03 06:25 PM


All times are GMT +1. The time now is 08:56 AM.

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

About Us

"It's about Microsoft Excel"