Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default formula based on first two charachters of a cell

I'm programming a bunch of IF statements into a spreadsheet.

The statements take the text of one cell and post a formula result in
another cell, such as: IF B2 = "SP-129", B3="Supply"

I was wondering if I can have the formula just key off of the first two text
charachters in the cell, shortening it to something like: IF B2=SP..,
B3="Supply"
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 192
Default formula based on first two charachters of a cell

=IF(LEFT(B2,2)="SP","Supply","")
--
-SA


"Phil G" wrote:

I'm programming a bunch of IF statements into a spreadsheet.

The statements take the text of one cell and post a formula result in
another cell, such as: IF B2 = "SP-129", B3="Supply"

I was wondering if I can have the formula just key off of the first two text
charachters in the cell, shortening it to something like: IF B2=SP..,
B3="Supply"

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 169
Default formula based on first two charachters of a cell

You can use a LEFT statement, so that IF(LEFT(B2,2)="SP","Supply","Other")
An easier way may be to create a table of codes and then use a VLOOKUP to
match against the name, that way you don't have to write a bunch of nested
IFs. It would look like this:

=VLOOKUP(LEFT(B2,2), A:B,2,FALSE) where A and B is where you table of codes
reside. This would also allow you to dynamically update or add to your table
of codes as well as support more than 8 categories (based on a max of 7
nested IFs)
--
Tips for Excel, Word, PowerPoint and Other Applications
http://www.kan.org/tips


"Phil G" wrote:

I'm programming a bunch of IF statements into a spreadsheet.

The statements take the text of one cell and post a formula result in
another cell, such as: IF B2 = "SP-129", B3="Supply"

I was wondering if I can have the formula just key off of the first two text
charachters in the cell, shortening it to something like: IF B2=SP..,
B3="Supply"

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default formula based on first two charachters of a cell

Thanks, it worked. I was going crazy trying to figure this one out.

What my problem was is that I had a whole bunch of text entries I needed
converted over, but it came out to too many values to keep nesting IF
statements or LOOKUP values into one formula. But I noticed I could just key
off of the first two charachters and save a bunch of IFs. So now I know.




"Phil G" wrote:

I'm programming a bunch of IF statements into a spreadsheet.

The statements take the text of one cell and post a formula result in
another cell, such as: IF B2 = "SP-129", B3="Supply"

I was wondering if I can have the formula just key off of the first two text
charachters in the cell, shortening it to something like: IF B2=SP..,
B3="Supply"

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alpha Charachters in Format Cells Custom Paul Moles Excel Worksheet Functions 3 February 16th 08 12:40 PM
formula for counting charachters in a cell ? Leezo Excel Discussion (Misc queries) 5 August 12th 05 09:51 PM
reduce # of charachters in same cell mortym Excel Worksheet Functions 1 April 20th 05 04:15 PM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 0 February 11th 05 05:35 AM


All times are GMT +1. The time now is 04:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"