ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF Q (https://www.excelbanter.com/excel-worksheet-functions/153150-if-q.html)

Sean

IF Q
 
How do I say the following

=IF(B8=Thursday,2,0) i.e. Return the value 2 if B8 returns
"Thursday"

Where B8 is a date but it is formatted to show the day


Thanks


PCLIVE

IF Q
 
One way:

=IF(WEEKDAY(B8)=5,2,0)

HTH,
Paul


--

"Sean" wrote in message
ups.com...
How do I say the following

=IF(B8=Thursday,2,0) i.e. Return the value 2 if B8 returns
"Thursday"

Where B8 is a date but it is formatted to show the day


Thanks




Harlan Grove[_2_]

IF Q
 
"Sean" wrote...
How do I say the following

=IF(B8=Thursday,2,0) i.e. Return the value 2 if B8 returns
"Thursday"

Where B8 is a date but it is formatted to show the day


=IF(TEXT(B8,"ddd")="Thu",2,0)

or

=IF(WEEKDAY(B9,2)=4,2,0)



Max

IF Q
 
Try: =IF(TEXT(B8,"dddd")="Thursday",2,0)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Sean" wrote:
How do I say the following

=IF(B8=Thursday,2,0) i.e. Return the value 2 if B8 returns
"Thursday"

Where B8 is a date but it is formatted to show the day


Thanks



Teethless mama

IF Q
 
=(WEEKDAY(A1)=5)*2


"Sean" wrote:

How do I say the following

=IF(B8=Thursday,2,0) i.e. Return the value 2 if B8 returns
"Thursday"

Where B8 is a date but it is formatted to show the day


Thanks



Rick Rothstein \(MVP - VB\)

IF Q
 
How do I say the following

=IF(B8=Thursday,2,0) i.e. Return the value 2 if B8 returns
"Thursday"

Where B8 is a date but it is formatted to show the day


=IF(TEXT(B8,"ddd")="Thu",2,0)

or

=IF(WEEKDAY(B9,2)=4,2,0)


I'm surprised you didn't offer these alternatives...

=2*(TEXT(B9,"ddd")="Thu")

=2*(WEEKDAY(B9,2)=4)

<g

Why, by the way, did you opt to use the 2nd argument in the WEEKDAY function
call instead of the simpler single-argument form of this function?

Rick


Harlan Grove

IF Q
 
"Rick Rothstein \(MVP - VB\)" wrote...
....
Why, by the way, did you opt to use the 2nd argument in the WEEKDAY
function call instead of the simpler single-argument form of this
function?


Because the OP has a UK e-mail address, and I'm not sure anyone
outside the US thinks of Sunday as the 1st day of the week. That is, I
was guessing the OP would find it more obvious to think of Thursday as
the 4th day of the week.


Peo Sjoblom

IF Q
 
Because the OP has a UK e-mail address, and I'm not sure anyone
outside the US thinks of Sunday as the 1st day of the week. That is, I
was guessing the OP would find it more obvious to think of Thursday as
the 4th day of the week.



Don't know if that is true for UK, in Sweden the week starts with Monday,
another thing is that it is easier for instance to use as a criteria e.g.


=WEEKDAY(A1,2)<6

is simpler than

=AND(WEEKDAY(A1)1,WEEKDAY(A1)<7)


--
Regards,

Peo Sjoblom




Rick Rothstein \(MVP - VB\)

IF Q
 
Why, by the way, did you opt to use the 2nd argument in the WEEKDAY
function call instead of the simpler single-argument form of this
function?


Because the OP has a UK e-mail address, and I'm not sure anyone
outside the US thinks of Sunday as the 1st day of the week. That is, I
was guessing the OP would find it more obvious to think of Thursday as
the 4th day of the week.


Ah! That is interesting. Not having an international background myself, it
never occurred to me that other countries might start their calendar week
with Monday instead of Sunday. That would probably be the explanation, then,
between the Sunday/Monday start of week options on those date functions
offering a start-of-week option... I just figured the option was there for
company workweek usage only, not for general calendar use. You learn
something new every day. Thanks Harlan.

Rick



All times are GMT +1. The time now is 09:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com