Note that there are some explanatory texts on larger screens.

plurals
  1. POExcel: need help with unusual lookup function (sorted column is different from lookup column)
    primarykey
    data
    text
    <p>I am having trouble constructing a unusual lookup formula in Excel. </p> <p>Normally, I would use VLOOKUP(), but the pitfall is that I want to look up a number in a column from a table that is sorted on <em>an other</em> column. Vlookup can only lookup things on the sorted column itself.</p> <p><strong>The scenario</strong> is as follows:</p> <ul> <li>The table is sorted ascending on column B. </li> <li>For a given parameter P, I now want to find the first A value, starting from the top and going down, that is bigger than or equal to that parameter P. </li> <li>The function should then return the corresponding B value.</li> </ul> <p>Table(part off, the complete table is much bigger):</p> <pre><code> A B 1 640 4.5 2 1600 7.0 3 640 7.5 4 1280 12.0 5 1920 16.5 6 2560 21.0 7 1600 19.8 8 3200 26.8 9 4800 33.8 </code></pre> <p><strong>For example</strong>, say my parameter is 1100, then I want my formula to return 7.0, because the first entry when searching downwards in column A that is bigger than or equal to 1100 is 1600, which has a corresponding B value of 7.0</p> <p>I've tried my luck with <a href="http://www.cpearson.com/excel/ArrayFormulas.aspx" rel="nofollow noreferrer">Array Formula's</a> (also known as "ctrl-shift-enter formula's") and constructed something like this:</p> <pre><code>{=INDEX(table; MATCH(MIN(IF(columnA-$C1&gt;=0;columnA;FALSE)); IF(columnA-$C1&gt;=0;columnA;FALSE); 0); 2)} </code></pre> <p>with <em>C1</em> containing my parameter, <em>table</em> the range A1:B9, and <em>columnA</em> the range B1:B9</p> <p>But that doesn't work (in the example above, it returns 12.0 because 1280 is selected by the MIN() function) .</p> <p><strong>Solution I don't want to use:</strong> I could write some VBA could to go through the table, but I don't want to do that (because of annoying 'macro warnings', and because Excel on Mac doesn't support VBA anymore)</p> <p>Anybody any clues?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload