ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Cell formatting (https://www.excelbanter.com/excel-worksheet-functions/8118-cell-formatting.html)

LizJ

Cell formatting
 
Hi, I have used lookup to return dates that I then want to use an IF function
to see whether the data matches. I have taken the data from two sources, one
gives me just the month, and the other provides the date in dd/mm/yyyy
format. What I want to know is when the month is the same. I have formatted
the dd/mm/yyyy cell to show the month, however, the underlying data is still
dd/mm/yyyy so when I use the if function I get an incorrect result. Is there
a way I can do this.

e.g.
Column A Column B
October October, but data is 30/10/2004
September June but data is 30/06/2004

In column C, I want to return whether the months are the same or not. Thanks

Max

Column A Column B
October October, but data is 30/10/2004
September June but data is 30/06/2004


One way

Try something along these lines in col C

In C2:

=IF(TEXT(B2,"mmmm")=A2,"Value_if_TRUE","Value_if_F ALSE")

Copy down
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"LizJ" wrote in message
...
Hi, I have used lookup to return dates that I then want to use an IF

function
to see whether the data matches. I have taken the data from two sources,

one
gives me just the month, and the other provides the date in dd/mm/yyyy
format. What I want to know is when the month is the same. I have

formatted
the dd/mm/yyyy cell to show the month, however, the underlying data is

still
dd/mm/yyyy so when I use the if function I get an incorrect result. Is

there
a way I can do this.

e.g.
Column A Column B
October October, but data is 30/10/2004
September June but data is 30/06/2004

In column C, I want to return whether the months are the same or not.

Thanks



LizJ

That seems to have worked a treat, thanks Max

"Max" wrote:

Column A Column B
October October, but data is 30/10/2004
September June but data is 30/06/2004


One way

Try something along these lines in col C

In C2:

=IF(TEXT(B2,"mmmm")=A2,"Value_if_TRUE","Value_if_F ALSE")

Copy down
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"LizJ" wrote in message
...
Hi, I have used lookup to return dates that I then want to use an IF

function
to see whether the data matches. I have taken the data from two sources,

one
gives me just the month, and the other provides the date in dd/mm/yyyy
format. What I want to know is when the month is the same. I have

formatted
the dd/mm/yyyy cell to show the month, however, the underlying data is

still
dd/mm/yyyy so when I use the if function I get an incorrect result. Is

there
a way I can do this.

e.g.
Column A Column B
October October, but data is 30/10/2004
September June but data is 30/06/2004

In column C, I want to return whether the months are the same or not.

Thanks




Max

Glad to hear that !
Thanks for the feedback
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----

LizJ wrote in message
...
That seems to have worked a treat, thanks Max






All times are GMT +1. The time now is 05:32 AM.

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