Excel Challaenge

arnapsui

Board Regular
Joined
Mar 16, 2010
Messages
55
Hi

I found the answer for the Excel Challenge ("Wildcard Lookup") in this forum. I still cannot understand why do they put a value "2^10" in the formula "=LOOKUP(2^10,SEARCH($D$2:$D$10,A2),$E$2:$E$10)". Can anyone explain what does it mean and why does it have that value?

Thanks
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Isn't it 2^15? That's 32,768, which is one more than the maximum number of characters in a cell, and therefore one more than the value that can be returned by SEARCH.
 
Upvote 0
It's actually 2^15
2 to the 15th power = 32768

So the formula is essentially
=LOOKUP(32768,SEARCH($D$2:$D$10,A2),$E$2:$E$10)

Search returns a number based on where the value is found within the cell.
Example,
=SEARCH("Jon","My name is Jon")
Searches for Jon within "My name is Jon"
so Jon is at the 12th position in the string, so search returns 12.

The maximum length of a string in a cell is 32767

So using 32768 in the lookup ensures that the lookup value is larger than any possible result of the search.
so it finds the LAST numeric result of the search.
 
Upvote 0

Forum statistics

Threads
1,224,612
Messages
6,179,887
Members
452,948
Latest member
Dupuhini

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