Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
AceWebmaster
 
Posts: n/a
Default Help With If Statement


Can anyone explain to me how to correct the following logical expression
which is designed to compare two columns. If the first column contains a
1 (indicating PM time) and if the second column contains an integer less
then 12(after 12 noon) I want to add 12 to the number from the second
column. This is used to create a 24 hour clock column so that 1:00PM is
13 and 2:00PM is 14.

I31 contains either 0 or 1 (0=AM, 1=PM)
J31 contains hours 0-12

if J31 is 1 then it is a PM hour.

=IF(((I31="1") AND (J31<12)),J31+12,J31)

The problem is that it doesn't like the AND logical expression.


--
AceWebmaster
------------------------------------------------------------------------
AceWebmaster's Profile: http://www.excelforum.com/member.php...o&userid=30912
View this thread: http://www.excelforum.com/showthread...hreadid=505895

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
BekkiM
 
Posts: n/a
Default Help With If Statement

=IF(AND(I31=1,J31<=12),J31+12,J31)

"AceWebmaster" wrote:


Can anyone explain to me how to correct the following logical expression
which is designed to compare two columns. If the first column contains a
1 (indicating PM time) and if the second column contains an integer less
then 12(after 12 noon) I want to add 12 to the number from the second
column. This is used to create a 24 hour clock column so that 1:00PM is
13 and 2:00PM is 14.

I31 contains either 0 or 1 (0=AM, 1=PM)
J31 contains hours 0-12

if J31 is 1 then it is a PM hour.

=IF(((I31="1") AND (J31<12)),J31+12,J31)

The problem is that it doesn't like the AND logical expression.


--
AceWebmaster
------------------------------------------------------------------------
AceWebmaster's Profile: http://www.excelforum.com/member.php...o&userid=30912
View this thread: http://www.excelforum.com/showthread...hreadid=505895


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete
 
Posts: n/a
Default Help With If Statement

I think J31 must contain numbers from 0 to 11, not to 12, in which case
the AND is not really required:

=IF(AND(I31=1,J31<=12),J31+12,J31)

can be replaced with:

=IF(I31=1,J31+12,J31)

Hope this helps.

Pete

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
daddylonglegs
 
Posts: n/a
Default Help With If Statement


try

=J31+I31*12


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=505895

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
AceWebmaster
 
Posts: n/a
Default Help With If Statement


Thanks everyone. The AND logic syntax had me baffled but now I
understand the syntax. The expressions worked great. The MOD also
worked great. I appreciate everyones help on resolving this.


--
AceWebmaster
------------------------------------------------------------------------
AceWebmaster's Profile: http://www.excelforum.com/member.php...o&userid=30912
View this thread: http://www.excelforum.com/showthread...hreadid=505895

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
SET statement tutorial Daminc Excel Discussion (Misc queries) 13 January 17th 06 04:47 PM
If Statement? John Excel Discussion (Misc queries) 1 January 16th 06 03:47 AM
If statement Matt Montagliano Excel Discussion (Misc queries) 1 September 8th 05 08:47 PM
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
7+ nested if statement? Turi Excel Worksheet Functions 3 December 20th 04 07:55 PM


All times are GMT +1. The time now is 02:38 PM.

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"