Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 121
Default IF Statement Modifications

Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default IF Statement Modifications

Maybe a different approach now you have more variables

=LOOKUP(B7,{"H","K","M","P"},{"JER","SHJ","MCJ","M OP"})

Mike

"Workbook" wrote:

Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default IF Statement Modifications

Workbook wrote:
Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7



One way:

=IF(ISERROR(FIND(B7,"HKMP")),"",MID("JERSHJMCJNOP" ,(FIND(B7,"HKMP")-1)*3+1,3))
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default IF Statement Modifications

Very nice

"Glenn" wrote:

Workbook wrote:
Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7



One way:

=IF(ISERROR(FIND(B7,"HKMP")),"",MID("JERSHJMCJNOP" ,(FIND(B7,"HKMP")-1)*3+1,3))

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default IF Statement Modifications

Hi,

You may also use the VLOOKUP() function. Please try
=VLOOKUP(B7,$C$9:$D$12,2,0). C$9:$D$12 is a table with two columns where
column C has H,K,M and P. Col. D has the acronyms

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Workbook" wrote in message
...
Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that
if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 121
Default IF Statement Modifications

This is great. It works awesome. Thanks Mike.

I am wondering, Is it possible to adjust this part of the statement
,{"H","K","M","P"} further to accomodate 10 different words of varying
lengths?

For instance, when I've tried something like this ,{"Wireless
Laptop","Desktop Computer","Flatscreen Monitor","Server","Solar
Panels","I-Phone","I-Pod","Dual Screen Monitor Stand","Wirless
Router"}{"JERA","SHJK","MCJM","MOPQ","ABPE","POMZ" ,"PDAI","COPN","ZTYL","HLMW"})
, some of them work and some of them don't and I couldn't figure out why.
Any thoughts?

"Mike H" wrote:

Maybe a different approach now you have more variables

=LOOKUP(B7,{"H","K","M","P"},{"JER","SHJ","MCJ","M OP"})

Mike

"Workbook" wrote:

Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 121
Default IF Statement Modifications

Thanks Glen, this is really cool. It works great.

Is this part of the code ")-1)*3+1,3)) saying something to the effect of
(excuse my VBA translation), count 3 letters there and stick 3 letters here,
count 1 letter here and stick one letter there? Does my question make sense?




"Glenn" wrote:

Workbook wrote:
Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7



One way:

=IF(ISERROR(FIND(B7,"HKMP")),"",MID("JERSHJMCJNOP" ,(FIND(B7,"HKMP")-1)*3+1,3))

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 121
Default IF Statement Modifications

Agreed!

"Mike H" wrote:

Very nice

"Glenn" wrote:

Workbook wrote:
Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7



One way:

=IF(ISERROR(FIND(B7,"HKMP")),"",MID("JERSHJMCJNOP" ,(FIND(B7,"HKMP")-1)*3+1,3))

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 121
Default IF Statement Modifications

Thank you for you're input. I am not sure if I implemented this formula
correctly. I had some trouble making it work. I wonder if it's something I
did wrong.

"Ashish Mathur" wrote:

Hi,

You may also use the VLOOKUP() function. Please try
=VLOOKUP(B7,$C$9:$D$12,2,0). C$9:$D$12 is a table with two columns where
column C has H,K,M and P. Col. D has the acronyms

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Workbook" wrote in message
...
Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that
if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7


  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default IF Statement Modifications

The statement (FIND(B7,"HKMP")-1) will return a number from 0 to 3 depending
upon the contents of B7. That result times 3 plus 1 (*3+1) turns {0, 1, 2, 3}
into {1, 4, 7, 10}. So, assuming B7 contains "M", you would get 7. The rest is
straight forward:

MID("JERSHJMCJNOP",7,3)="MCJ"


Workbook wrote:
Thanks Glen, this is really cool. It works great.

Is this part of the code ")-1)*3+1,3)) saying something to the effect of
(excuse my VBA translation), count 3 letters there and stick 3 letters here,
count 1 letter here and stick one letter there? Does my question make sense?




"Glenn" wrote:

Workbook wrote:
Thank you TValko for this statement =IF(Sheet1!B7="H","JER",""). I am
wondering can it be modified to include the 4 following variations so that if
H, K, M, or P is entered into cell B7 the associated acronym will appear?

If K is entered in cell B7 on Sheet1 then SHJ will appear in J7
If M is entered in cell B7 on Sheet1 then MCJ will appear in J7
If P is entered in cell B7 on Sheet1 then NOP will appear in J7


One way:

=IF(ISERROR(FIND(B7,"HKMP")),"",MID("JERSHJMCJNOP" ,(FIND(B7,"HKMP")-1)*3+1,3))

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
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
turn off excel cell modifications? Fredrated Excel Discussion (Misc queries) 1 February 8th 08 07:22 AM
How to Export as text file with NO delimiters or modifications? MojoNixon Excel Discussion (Misc queries) 5 August 15th 06 09:37 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM
webbrowser - excel - modifications [email protected] Excel Discussion (Misc queries) 1 January 26th 06 04:31 AM


All times are GMT +1. The time now is 12:16 AM.

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

About Us

"It's about Microsoft Excel"