#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default If statement

I need help with a formula/macro. I have a formula that selects cell c9 and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 186
Default If statement

Hi David,
How about C12=IF(WEEKDAY(C9-1)=7,C9-3,C9-1)

--
Ken Hudson


"David T" wrote:

I need help with a formula/macro. I have a formula that selects cell c9 and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default If statement

Here's one way:

=IF(TEXT(C9-1,"ddd")="Sun",C9-3.C9-1)

Biff

"David T" wrote in message
...
I need help with a formula/macro. I have a formula that selects cell c9
and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default If statement

One way:

C12: =C9-1-2*(WEEKDAY(C9)=1)

WORKDAY() is in the Analysis Toolpak Add-in (Tools/Add-ins...)


In article ,
David T wrote:

I need help with a formula/macro. I have a formula that selects cell c9 and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default If statement

Typo:

=IF(TEXT(C9-1,"ddd")="Sun",C9-3.C9-1)


Should be:

=IF(TEXT(C9-1,"ddd")="Sun",C9-3,C9-1)

Format as DATE

Biff

"T. Valko" wrote in message
...
Here's one way:

=IF(TEXT(C9-1,"ddd")="Sun",C9-3.C9-1)

Biff

"David T" wrote in message
...
I need help with a formula/macro. I have a formula that selects cell c9
and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default If statement

=IF(WEEKDAY(C9-1)=7,C9-3,C9-1)

Using that syntax weekday 7 = Saturday

Try:

=IF(WEEKDAY(C9-1)=1,C9-3,C9-1)
=IF(WEEKDAY(C9-1,2)=7,C9-3,C9-1)

Biff

"Ken Hudson" wrote in message
...
Hi David,
How about C12=IF(WEEKDAY(C9-1)=7,C9-3,C9-1)

--
Ken Hudson


"David T" wrote:

I need help with a formula/macro. I have a formula that selects cell c9
and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default If statement

Probably not a great concern, but if your workbook may be used with
non-English versions of XL, using WEEKDAY(C9)=1 will still work where
TEXT(C9-1,"ddd")="Sun" won't.

In article ,
"T. Valko" wrote:

Typo:

=IF(TEXT(C9-1,"ddd")="Sun",C9-3.C9-1)


Should be:

=IF(TEXT(C9-1,"ddd")="Sun",C9-3,C9-1)

Format as DATE

Biff

"T. Valko" wrote in message
...
Here's one way:

=IF(TEXT(C9-1,"ddd")="Sun",C9-3.C9-1)

Biff

"David T" wrote in message
...
I need help with a formula/macro. I have a formula that selects cell c9
and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)




  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default If statement

Ignore the third line - got pasted from a previous message...

In article ,
JE McGimpsey wrote:

One way:

C12: =C9-1-2*(WEEKDAY(C9)=1)

WORKDAY() is in the Analysis Toolpak Add-in (Tools/Add-ins...)


In article ,
David T wrote:

I need help with a formula/macro. I have a formula that selects cell c9
and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default If statement

Hello everyone-

Thanks for your help. All of those formulas work great. I only picked one
and added it to my sheet.

"JE McGimpsey" wrote:

One way:

C12: =C9-1-2*(WEEKDAY(C9)=1)

WORKDAY() is in the Analysis Toolpak Add-in (Tools/Add-ins...)


In article ,
David T wrote:

I need help with a formula/macro. I have a formula that selects cell c9 and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)


  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default If statement

And... I misinterpreted "that day":

=C9-1-2*(WEEKDAY(C9)=2)


In article ,
JE McGimpsey wrote:

One way:

C12: =C9-1-2*(WEEKDAY(C9)=1)

WORKDAY() is in the Analysis Toolpak Add-in (Tools/Add-ins...)


In article ,
David T wrote:

I need help with a formula/macro. I have a formula that selects cell c9
and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)



  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default If statement

WORKDAY() is in the Analysis Toolpak Add-in (Tools/Add-ins...)

Yeah, WORKDAY is, but not WEEKDAY.

Think you need to subtract 1 in WEEKDAY:

=C9-1-2*(WEEKDAY(C9-1)=1)

Biff

"JE McGimpsey" wrote in message
...
One way:

C12: =C9-1-2*(WEEKDAY(C9)=1)

WORKDAY() is in the Analysis Toolpak Add-in (Tools/Add-ins...)


In article ,
David T wrote:

I need help with a formula/macro. I have a formula that selects cell c9
and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)



  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default If statement

Yup, see my two (or is it three) previous posts...

Thanks for the correction.

In article ,
"T. Valko" wrote:

WORKDAY() is in the Analysis Toolpak Add-in (Tools/Add-ins...)


Yeah, WORKDAY is, but not WEEKDAY.

Think you need to subtract 1 in WEEKDAY:

=C9-1-2*(WEEKDAY(C9-1)=1)

Biff

"JE McGimpsey" wrote in message
...
One way:

C12: =C9-1-2*(WEEKDAY(C9)=1)

WORKDAY() is in the Analysis Toolpak Add-in (Tools/Add-ins...)


In article ,
David T wrote:

I need help with a formula/macro. I have a formula that selects cell c9
and
subtracts it by 1 day. If that day is a Sunday, I want the formula to
subtract by 3 days. However, my current formula doesn't subtract by 3.
Please help

C9 : May 21, 2007

C12 =IF(C9-1= "Sunday",C9-3,C9-1)

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
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM
Help with IF Statement Cheryl B. Excel Worksheet Functions 3 November 3rd 05 09:40 PM
IF Statement Help please mark Excel Worksheet Functions 2 November 2nd 05 06:32 PM
If statement and Isblank statement Rodney C. Excel Worksheet Functions 0 January 18th 05 08:39 PM
Help please, IF statement/SUMIF statement Brad_A Excel Worksheet Functions 23 January 11th 05 02:24 PM


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