Find a value column header table

drom

Well-known Member
Joined
Mar 20, 2005
Messages
528
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and thanks in advance!

I know how to do this using VBA
I am trying to have this done using a formula

C8:G9 is a table
The header of the table keeps the string despite I am putting values
So when I have to find a value within the header and the desired value is not a perfect match

How can I get get C5:E6 ??

Book3
ABCDEFGHIJKLMNO
1
2This Eg is just for my Query
3
4Lookup Value55661
5Desired result13465This is What I am expecting using a formula
6Desired Colimn Answer245This is What I am expecting using a formula
7
8YEAR1153465I can Add more years to my column (eg in H8)
9
10
11
12
13
Sheet1
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
The name of my table is Table1 (y)
Thanks. That answers my second question, but not the first. ;)

All I could guess was:
Lookup value of 5 is not found in the table so return the next lowest value that is found in the table (=1)
Lookup value of 56 is not found in the table so return the next lowest value that is found in the table (=34)
Lookup value of 61 is not found in the table so return the next lowest value that is found in the table (=34)

Obviously my guessed logic is incorrect because you say the 3rd result should be 65, not 34. That's why I am asking for the logic to be explained.
 
Last edited:
Upvote 0
I have to use a vlookup, I know how to find a Sting in a column
But since tables headers are strings
How can I find the column number using a non exact match number value
I can use above the table the numbers but the table may grow in column numbers
And I would like to know if there is any other way

Thanks
 
Upvote 0
How can I find the column number using a non exact match number value
You still have not explained how your non-exact match is supposed to work. As I explained in my last post for two of your non-exact matches your desired result is a lower number, but for the other non-exact match your desired result is higher number.
 
Upvote 0
  • B5:B6 shows my questions
  • If I put C4:E4 by hand
    • I would like to get using a formula C5:E5
  • If I put C4:E4 by hand
    • I would like to get using a formula C6:E6 ( a different formula)

Green Cells are expecting a formula, I do not know hot to get this done


Row 4 are my Targets,
Row 5: C5:E5 I need a formula
Row 6: C6:E6 I need a different formula tha the one I need for row 5
I Row 5 and 6 in green color are the formulas I need (two different formulas, one for each row)

THANKS
 
Upvote 0
OK, since you seem to be refusing to give any logic behind the answers that you want to get, I'll make up some of my own.
This gives the results that you asked for.

drom.xlsm
BCDEFG
4Lookup Value55661
5Desired result13465
6Desired Colimn Answer245
7
8YEAR1153465
9
Sheet1
Cell Formulas
RangeFormula
C5:E5C5=XLOOKUP(C4:E4,--Table1[#Headers],--Table1[#Headers],,IF(C4:E4<60,-1,1))
C6:E6C6=MATCH(C5#&"",Table1[#Headers],0)
Dynamic array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,216,589
Messages
6,131,591
Members
449,657
Latest member
Timber5

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top