Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 37
Default how do I obtain position of specific value in a row of numbers

I have a row of 10 binary values in a row (column a to J for example). an
example follows:

0010011000

I need a formula that will return the position (numerically) of the first
"1" and another that will give the position of the last "1".

for the above, the formulas would return 3 and 7 respectively.

Can anyone advise?

anand
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,688
Default how do I obtain position of specific value in a row of numbers

Hi!

Try these:

For the first:

=MATCH(1,A1:J1,0)

For the last:

=LOOKUP(2,1/(A1:J1=1),COLUMN(A1:J1))

Biff

"anand" wrote in message
...
I have a row of 10 binary values in a row (column a to J for example). an
example follows:

0010011000

I need a formula that will return the position (numerically) of the first
"1" and another that will give the position of the last "1".

for the above, the formulas would return 3 and 7 respectively.

Can anyone advise?

anand



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 37
Default how do I obtain position of specific value in a row of numbers



"Biff" wrote:

Hi!

Try these:

For the first:

=MATCH(1,A1:J1,0)

For the last:

=LOOKUP(2,1/(A1:J1=1),COLUMN(A1:J1))

Biff

"anand" wrote in message
...
I have a row of 10 binary values in a row (column a to J for example). an
example follows:

0010011000

I need a formula that will return the position (numerically) of the first
"1" and another that will give the position of the last "1".

for the above, the formulas would return 3 and 7 respectively.

Can anyone advise?

anand



Close but not quite for the 2nd one.


The data is entered in repeating blocks spread out by about 15 columns. So
there is a block of data of 10 columns every 15 columns (i.e. 5 blank columns
between each). The 2nd formula works ok if the data is in column A to J but
does not work for other columns.

Is there a version that will work for other positions?

For what it is worth, the cells into which the formula will be placed is
always 2 spaces to the left of the data block of interest. E. g if the first
of the 10 columns with the binary data is G, then the formula will go in E.
If the first of the 10 data columns is V, the formula will paste into T.

Can you advise?

anand
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,688
Default how do I obtain position of specific value in a row of numbers

That's why it's always a good idea to tell us where your data is.

If your range of data was G1:P1

=LOOKUP(2,1/(G1:P1=1),COLUMN(G1:P1)-COLUMN(G1)+1)

If your range of data was V1:AE1

=LOOKUP(2,1/(V1:AE1=1),COLUMN(V1:AE1)-COLUMN(V1)+1)

Biff

"anand" wrote in message
...


"Biff" wrote:

Hi!

Try these:

For the first:

=MATCH(1,A1:J1,0)

For the last:

=LOOKUP(2,1/(A1:J1=1),COLUMN(A1:J1))

Biff

"anand" wrote in message
...
I have a row of 10 binary values in a row (column a to J for example).
an
example follows:

0010011000

I need a formula that will return the position (numerically) of the
first
"1" and another that will give the position of the last "1".

for the above, the formulas would return 3 and 7 respectively.

Can anyone advise?

anand



Close but not quite for the 2nd one.


The data is entered in repeating blocks spread out by about 15 columns.
So
there is a block of data of 10 columns every 15 columns (i.e. 5 blank
columns
between each). The 2nd formula works ok if the data is in column A to J
but
does not work for other columns.

Is there a version that will work for other positions?

For what it is worth, the cells into which the formula will be placed is
always 2 spaces to the left of the data block of interest. E. g if the
first
of the 10 columns with the binary data is G, then the formula will go in
E.
If the first of the 10 data columns is V, the formula will paste into T.

Can you advise?

anand



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,688
Default how do I obtain position of specific value in a row of numbers

This may be less confusing:

{1,2,3,4...,10}

Represents the total number of cells in the range and thus, the values
position:

=LOOKUP(2,1/(B1:K1=1),{1,2,3,4,5,6,7,8,9,10})

Biff

"Biff" wrote in message
...
That's why it's always a good idea to tell us where your data is.

If your range of data was G1:P1

=LOOKUP(2,1/(G1:P1=1),COLUMN(G1:P1)-COLUMN(G1)+1)

If your range of data was V1:AE1

=LOOKUP(2,1/(V1:AE1=1),COLUMN(V1:AE1)-COLUMN(V1)+1)

Biff

"anand" wrote in message
...


"Biff" wrote:

Hi!

Try these:

For the first:

=MATCH(1,A1:J1,0)

For the last:

=LOOKUP(2,1/(A1:J1=1),COLUMN(A1:J1))

Biff

"anand" wrote in message
...
I have a row of 10 binary values in a row (column a to J for example).
an
example follows:

0010011000

I need a formula that will return the position (numerically) of the
first
"1" and another that will give the position of the last "1".

for the above, the formulas would return 3 and 7 respectively.

Can anyone advise?

anand


Close but not quite for the 2nd one.


The data is entered in repeating blocks spread out by about 15 columns.
So
there is a block of data of 10 columns every 15 columns (i.e. 5 blank
columns
between each). The 2nd formula works ok if the data is in column A to J
but
does not work for other columns.

Is there a version that will work for other positions?

For what it is worth, the cells into which the formula will be placed is
always 2 spaces to the left of the data block of interest. E. g if the
first
of the 10 columns with the binary data is G, then the formula will go in
E.
If the first of the 10 data columns is V, the formula will paste into T.

Can you advise?

anand







  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default how do I obtain position of specific value in a row of numbers

Where your data is in A1:
First position:
=FIND(1,A1)

Last position (array entered using Control+Shift+Enter):
=MAX(FIND(1,A1,ROW(INDIRECT("1:"&LEN(A1)))))

"anand" wrote:

I have a row of 10 binary values in a row (column a to J for example). an
example follows:

0010011000

I need a formula that will return the position (numerically) of the first
"1" and another that will give the position of the last "1".

for the above, the formulas would return 3 and 7 respectively.

Can anyone advise?

anand

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
Adding numbers from a list over a specific value Herd96 Excel Discussion (Misc queries) 4 May 15th 06 02:21 PM
Replacing specific numbers jezzica85 Excel Discussion (Misc queries) 2 May 5th 06 12:16 AM
Select specific numbers from a list based on position judoist Excel Discussion (Misc queries) 1 November 21st 05 04:19 PM
Replacing a specific position in a cell with something else McDal Excel Discussion (Misc queries) 5 May 3rd 05 08:37 PM
How do I format a cell so that only specific numbers can be enter. Jim Excel Discussion (Misc queries) 1 February 1st 05 04:51 PM


All times are GMT +1. The time now is 10:55 AM.

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"