Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If Cell Starts with Text String... Formula

Tags:

I have formula that checks if the cell starts with text "A" returns Pick up "B" for Collect and C for Prepaid.

But it doesn't seems to be working properly

Both A and C returns Prepaid...

=LOOKUP(LEFT(A1),{"A","B","C"},{"Pick Up","Collect","Prepaid"})

like image 962
ggmkp Avatar asked Jul 24 '13 22:07

ggmkp


1 Answers

I'm not sure lookup is the right formula for this because of multiple arguments. Maybe hlookup or vlookup but these require you to have tables for values. A simple nested series of if does the trick for a small sample size

Try =IF(A1="a","pickup",IF(A1="b","collect",IF(A1="c","prepaid","")))

Now incorporate your left argument

=IF(LEFT(A1,1)="a","pickup",IF(LEFT(A1,1)="b","collect",IF(LEFT(A1,1)="c","prepaid","")))

Also note your usage of left, your argument doesn't specify the number of characters, but a set.


7/8/15 - Microsoft KB articles for the above mentioned functions. I don't think there's anything wrong with techonthenet, but I rather link to official sources.

  • lookup
  • hlookup
  • vlookup
  • if
  • left
like image 81
Raystafarian Avatar answered Oct 14 '22 03:10

Raystafarian