title: Excel - Is there a way to tell a cell to use a certain function based on the first letter of a another cell?
body: <p>I am creating a Product Decoder for a project.</p>
  <p>Lets say, Our product can have a code such as &quot;ABCDE&quot; OR a code like &quot;BCDEF&quot;.</p>
  <p>ABCDE has a table of data that I use to decode using a lookup. For example AB can decode into &quot;Potato&quot; and CDE can decode into &quot;Chip&quot;. So any combination with AB can be Potato &quot;Anything else&quot;.</p>
  <p>BCDER, BC can decode into &quot;Veggie&quot; so DER can code into &quot;Chip&quot;.</p>
  <p>I also use the 1/search method to take placements for the decode. Example =IFERROR(LOOKUP(2,1/SEARCH($E$19:$E$23,N18),$E$19:$E$23), &quot;&quot;)</p>
  <p>I concatenate all the decodes using =S2&amp;&quot; &quot;&amp;T2&amp;&quot; &quot;&amp;U2&amp;&quot; &quot;&amp;V2</p>
  <p>Question is...if we are getting a huge amount of product code coming that I want to decode into one single column... How do I tell excel to use this table of data for ABCDE if product starts with &quot;A&quot;, if not, use table of data that correlates to BCDER when product starts with &quot;B&quot;.</p>
  <p>Edit 1:</p>
  <p><a href="https://i.stack.imgur.com/NpQeh.png" rel="nofollow noreferrer">Here is my table, right side is where i look up the Part Number column N&quot;</a></p>
  <p>As you can see on column &quot;W&quot; I concatenate the date is Look up from columns O~V.
  Column O Function: =IFERROR(LOOKUP(2,1/SEARCH($C$1:$C$7,N2),$C$1:$C$7), &quot;&quot;)</p>
  <p>On column N, I have two parts. One that starts with M and one that starts with K which is pretty standard.</p>
  <p><a href="https://i.stack.imgur.com/IK0ZN.png" rel="nofollow noreferrer">Image two is me trying to use the IF Left but, it doesn't really work</a>
  =IF(LEFT(AA4,10) = &quot;M &quot;, W2, W18)</p>
  <p>So How can I tell my excel page to use Table A1:A12 if part starts with &quot;M*&quot; and vice versa?</p>
  <p>Let me know if this is confusing, I will do my best to clear things up.</p>