function bar for C3 cell to equal C2 cell

data808

Active Member
Joined
Dec 3, 2010
Messages
353
Office Version
  1. 2019
Platform
  1. Windows
I have a cell C3 that is a date formatted cell like this: mm/dd/yy

I would like cell C2 to only pull the month from that C3 cell and spell out the whole word. I been typing in the function bar like so:
=format(range("C3), "mmmm" and its not working cause it thinks its a formula from the equal sign but I don't know what else to use.

Can anyone help me with this? Thanks.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
The merged cells wouldn't cause that. The value in E3 might not be a date? Possibly a text value?
Ok I tried formatting the cell with 3 formats. Date, Text, and General. Each time I formatted the cell, I made sure the function bar was empty. After changing the format then I would save and exit the file then open it back up and plug your code into the function bar and each time I would get the #VALUE! error.
 
Upvote 0
OK, I'll need to see your actual data using the XL2BB Add in before I can help you any further. The problem is that the formula works fine for me (even with merged cells - see below) so I can't reproduce your error.

test.xlsm
CDE
2May
35/05/20225/05/2022
Sheet2
Cell Formulas
RangeFormula
C2C2=IF(MONTH(C3)=MONTH(E3),TEXT(C3,"mmmm"),TEXT(C3,"mmmm")&" - "&TEXT(E3,"mmmm"))


test.xlsm
CDE
2May - December
35/05/20225/12/2022
Sheet2
Cell Formulas
RangeFormula
C2C2=IF(MONTH(C3)=MONTH(E3),TEXT(C3,"mmmm"),TEXT(C3,"mmmm")&" - "&TEXT(E3,"mmmm"))
 
Upvote 0
OK, I'll need to see your actual data using the XL2BB Add in before I can help you any further. The problem is that the formula works fine for me (even with merged cells - see below) so I can't reproduce your error.

test.xlsm
CDE
2May
35/05/20225/05/2022
Sheet2
Cell Formulas
RangeFormula
C2C2=IF(MONTH(C3)=MONTH(E3),TEXT(C3,"mmmm"),TEXT(C3,"mmmm")&" - "&TEXT(E3,"mmmm"))


test.xlsm
CDE
2May - December
35/05/20225/12/2022
Sheet2
Cell Formulas
RangeFormula
C2C2=IF(MONTH(C3)=MONTH(E3),TEXT(C3,"mmmm"),TEXT(C3,"mmmm")&" - "&TEXT(E3,"mmmm"))
I just tested it on a blank spreadsheet and it works. I also just thought of why it may not be working on my main spreadsheet and it could be because C3 and E3 are not cell values entered by the user. They are pulling the date values from sheet1. C3 and E3 have these in the function bar:

C3 =IF(sheet1!B2<>"",sheet1!B2,"")
E3 =IF(sheet1!Z2<>"",sheet1!Z2,"")
 
Upvote 0
OK, I'll need to see your actual data using the XL2BB Add in before I can help you any further. The problem is that the formula works fine for me (even with merged cells - see below) so I can't reproduce your error.

test.xlsm
CDE
2May
35/05/20225/05/2022
Sheet2
Cell Formulas
RangeFormula
C2C2=IF(MONTH(C3)=MONTH(E3),TEXT(C3,"mmmm"),TEXT(C3,"mmmm")&" - "&TEXT(E3,"mmmm"))


test.xlsm
CDE
2May - December
35/05/20225/12/2022
Sheet2
Cell Formulas
RangeFormula
C2C2=IF(MONTH(C3)=MONTH(E3),TEXT(C3,"mmmm"),TEXT(C3,"mmmm")&" - "&TEXT(E3,"mmmm"))
Did more testing and its because of the IF statement in the function. That's because when the cell on sheet1 is blank then the cell in sheet2 used to have some random January date and so I didn't want that. I wanted it to be blank as well. I also notice that the code you provided does something similar. If the cells C3 and E3 are blank then it will default to "January" in cell C2. So eventually I would like C2 to be blank as well if the other cells are blank that C2 needs to pull from. Would that be possible? Or is that getting too complicated? Sorry for the confusion also thanks for taking the time to figure this one out. This is way beyond me.
 
Upvote 0
Did more testing and its because of the IF statement in the function. That's because when the cell on sheet1 is blank then the cell in sheet2 used to have some random January date and so I didn't want that. I wanted it to be blank as well. I also notice that the code you provided does something similar. If the cells C3 and E3 are blank then it will default to "January" in cell C2. So eventually I would like C2 to be blank as well if the other cells are blank that C2 needs to pull from. Would that be possible? Or is that getting too complicated? Sorry for the confusion also thanks for taking the time to figure this one out. This is way beyond me.
No worries, leave it with me.
 
Upvote 0
Try this to start with

Excel Formula:
=IF(C3="","",IF(MONTH(C3)=MONTH(E3),TEXT(C3,"mmmm"),TEXT(C3,"mmmm")&" - "&TEXT(E3,"mmmm")))
 
Upvote 0
Try this to start with

Excel Formula:
=IF(C3="","",IF(MONTH(C3)=MONTH(E3),TEXT(C3,"mmmm"),TEXT(C3,"mmmm")&" - "&TEXT(E3,"mmmm")))
Perfect! No need to start with it. This is going in permanently. Works exactly how I wanted. Thank you very much for all the help @kevin9999.
 
Upvote 0

Forum statistics

Threads
1,215,019
Messages
6,122,707
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top