Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
brookdale
 
Posts: n/a
Default Layered "If" statement.


I would like to know if someone could tell me how to do this.

I have to check if a cell contains the letter M. If it does, then the
word monday must be inserted into another cell. If it is not M, then it
must check to see if it is a T for tuesday. This must continue, checking
for w, th, and f.

I have been trying something like this, but it doesnt work:

{for, say L3}

=if(H3=M,monday,(if(H3=T,tuesday,____________)))

I skipped the ___________

Help?


--
brookdale
------------------------------------------------------------------------
brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
View this thread: http://www.excelforum.com/showthread...hreadid=382076

  #2   Report Post  
William DeLeo
 
Posts: n/a
Default


Not that I'm a guru ... I'm just waiting for somone to help me with my
question.

But, it worked for me the way you were trying it. I expect you have
your syntax messed up (extra parentheses around the IF, missing quotes,
etc.?).

Use the below as an example.

=IF(D2="M","Monday",IF(D2="T","Tuesday",IF(D2="W", "Wednesday",IF(D2="R","Thursday","Friday"))))

Good luck!


--
William DeLeo
------------------------------------------------------------------------
William DeLeo's Profile: http://www.excelforum.com/member.php...fo&userid=1256
View this thread: http://www.excelforum.com/showthread...hreadid=382076

  #3   Report Post  
brookdale
 
Posts: n/a
Default


Wow, thank you so much. You are amazing! Now, I have one more even
specific question. you have, say, =M. What I would need it to be is
contains the phrase "T M", "T T", "T W", etc... This is part of a
larger passage and there is a T and space before each of the M, T, W,
Th, or F. So rather than have equal (=), how would I do contains?
Thanks again.

I may be out today, but I will be back on Monday. Thanks!


--
brookdale
------------------------------------------------------------------------
brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
View this thread: http://www.excelforum.com/showthread...hreadid=382076

  #4   Report Post  
William DeLeo
 
Posts: n/a
Default


If the format of the cell containing the letter is always the same, then
you could use the MID function. For example, if the cell contained "T
M", and you are looking at the M to designate Monday, then replace the
D2 with:

MID(D2,3,1)

Note that spaces are counted so this formula is counting from the left
3 characters (T,space,M) and returing 1 character starting with the M
... i.e. just M.

Look up the RIGHT, LEFT and MID functions. One of those should do the
trick.


--
William DeLeo
------------------------------------------------------------------------
William DeLeo's Profile: http://www.excelforum.com/member.php...fo&userid=1256
View this thread: http://www.excelforum.com/showthread...hreadid=382076

  #5   Report Post  
William DeLeo
 
Posts: n/a
Default


one more thing ... note that if "Th" is your flag for Thursday, then the
MID formula for the Thursday IF statement would need to return 2
characters vs 1 (i.e MID(D2,3,2))


--
William DeLeo
------------------------------------------------------------------------
William DeLeo's Profile: http://www.excelforum.com/member.php...fo&userid=1256
View this thread: http://www.excelforum.com/showthread...hreadid=382076



  #6   Report Post  
brookdale
 
Posts: n/a
Default


I dont understand. How would I edit

=IF(D2="M","Monday",IF(D2="T","Tuesday",IF(D2="W", "Wednesday",IF(D2="R","Thursday","Friday"))))

so that the logical test part (the first one being D2="M") can be

D2{contains}"T M"

?

I want to replace D2="M" with D2{contains}"T M", but I just do not know
how to notate this.

Thank you so much though for your time.

:)


--
brookdale
------------------------------------------------------------------------
brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
View this thread: http://www.excelforum.com/showthread...hreadid=382076

  #7   Report Post  
brookdale
 
Posts: n/a
Default


Anyone have any ideas at all?


--
brookdale
------------------------------------------------------------------------
brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
View this thread: http://www.excelforum.com/showthread...hreadid=382076

  #8   Report Post  
Dave Peterson
 
Posts: n/a
Default

I'd create a small table on another worksheet.

Put the abbreviations in column A and the long names in column B.

=vlookup(a1,sheet2!a:b,2,false)

to return the longer name.

brookdale wrote:

Anyone have any ideas at all?

--
brookdale
------------------------------------------------------------------------
brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
View this thread: http://www.excelforum.com/showthread...hreadid=382076


--

Dave Peterson
  #9   Report Post  
brookdale
 
Posts: n/a
Default


Here is another idea that I had. How could I make a function that would
return the vaule of the 6th space in another cell.

{For, say D3}

IF((space 6 of B3)="M","Monday",IF((space 6 of
B3)="T","Tuesday",IF(_________)

The part in red is what I dont know how to do (as you can see I am new
to excel. I just skipped the _______ rather than type it all out.

Thanks again for all your help.


--
brookdale
------------------------------------------------------------------------
brookdale's Profile: http://www.excelforum.com/member.php...o&userid=24617
View this thread: http://www.excelforum.com/showthread...hreadid=382076

  #10   Report Post  
William DeLeo
 
Posts: n/a
Default


Look up the MID function in the help menu.

To extract character 6 from a series of characters in D2, replace D2
with MID(D2, 6, 1).

e.g.

=IF(MID(D2, 6, 1)="M","Monday",IF(MID(D2, 6,
1)="T","Tuesday",IF(MID(D2, 6, 1)="W","Wednesday",IF(MID(D2, 6,
1)="R","Thursday",IF(MID(D2, 6, 1)="F",""Friday")))))

Again note that this is using "R" for Thursday ... if you have "Th"
taking up spots 6 and 7, then use:

=IF(MID(D2, 6, 1)="M","Monday",IF(MID(D2, 6,
1)="T","Tuesday",IF(MID(D2, 6, 1)="W","Wednesday",IF(MID(D2, 6,
2)="Th","Thursday",IF(MID(D2, 6, 1)="F",""Friday")))))


--
William DeLeo
------------------------------------------------------------------------
William DeLeo's Profile: http://www.excelforum.com/member.php...fo&userid=1256
View this thread: http://www.excelforum.com/showthread...hreadid=382076

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
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
IF Statement nightmare eugenevr Excel Discussion (Misc queries) 6 May 18th 05 01:09 PM
IF Statement Brent New Users to Excel 3 April 29th 05 04:24 PM
How to calculate a sum as one outcome of an IF statement barb in NC Excel Worksheet Functions 2 March 31st 05 08:01 PM
How do I fix a circular reference in a financial statement? drjayhawk25 Excel Discussion (Misc queries) 0 February 7th 05 05:19 PM


All times are GMT +1. The time now is 04:09 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"