View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic
 
Posts: n/a
Default Return SEARCHED Column Number of Numeric Label and Value

Try the following...

Let T11 contain your criteria/numerical label

U11:

=MATCH(T11,$F$10:$R$10,0)

This will return the column position.

V11:

=INDEX(F11:R11,U11)+1

This will return the corresponding value in Row 11, and add 1.

W11:

=IF(U111,LOOKUP(2,1/(F11:INDEX(F11:R11,U11-1)=V11),COLUMN(F11:INDEX(F11
:R11,U11-1))-COLUMN(F11)+1)+1,#N/A)

This will search left for the first column containing a value greater
than or equal to V11, return the column position, and add 1. If the
column number representing the numeric label is 1, the formula will
return #N/A since no values exist to the left.

X11:

=IF(U111,IF(ISNA(W11),LOOKUP(2,1/(F11:INDEX(F11:R11,U11-1)=T11),COLUMN(
F11:INDEX(F11:R11,U11-1))-COLUMN(F11)+1)+1,W11),#N/A)

Here, if W11 equals #N/A, the numerical label is used to search left for
the first column containing a value greater than or equal to the numeric
value, return the column position, and add 1. Otherwise, it returns the
value in W11. And, again, if the column number representing the numeric
label is 1, the formula will return #N/A since no values exist to the
left.

Post back if I misinterpreted your intent...

Hope this helps!

In article <5a41f381f663a@uwe, "Sam via OfficeKB.com" <u4102@uwe
wrote:

Hi All,

I would like a flexible Formula to Return the Column Number of individual
Numeric Labels and their Numeric Value. I have a 2-Row by many Columns
chart/ grid layout. My 1st Column, Column Number "1" is Excel Column Letter
"F".

Numeric Label 17 is housed in Column Number "12" per my chart , its Numeric
Value 5 is housed on the next Row - directly below the Numeric Label.

Sample Data:

---------------------Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8 Col9 Col10 Col11
Col12 Col13 etc
-Numeric Label 3 2 6 0 8 4 5 9
11 1 10 17 7
-Numeric Value 18 15 12 11 8 7 7 6 6
5 5 5 4


Scenario:
To Return the correct Column Number: locate the Numeric Label 17 and its
Numeric Value on the Row below, Numeric Value is 5. The Numeric Value is to
be increased by a Value of 1 (one) - NEW Numeric Value = 6. The Column
Number Returned should reflect Numeric Label of 17 remains the same but the
Numeric Value is increased by one.

To Return a Column Number representing the Numeric Label 17 and its original
Numeric Value +1 (plus one): the Numeric Label is still 17 but the Numeric
Value is NOW 6. From the oringal Column Number that housed Numeric Label 17,
that is Column Number "12", SEARCH in Ascending order: moving LEFT from
Column Number "12" and using the Numeric Value as the 1st (first) search
order and the Numeric Label as the 2nd (second) Ascending search order.
SEARCH the Numeric Value Row until the first Numeric Value either equal to 6
or more than 6 is found. Then Return the Column Number of the Column to the
Right of that Numeric Value.

Required Result:
Return the Column Number based on the Numeric Label 17 and the NEW Numeric
Value of 6, search in Ascending order - First search order based on Numeric
Value 6 - Second search order based on Numeric Label 17.

Returned Result should be Column Number 10.

Thanks
Sam