+ Reply to Thread
Results 1 to 9 of 9

Month Codes in formula

  1. #1
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Month Codes in formula

    Why is the formula in C6 returning the value "9985"? There is only one entry in column AF on the All Closed Positions tab with a January date in it so it should return the value of "1". In cell C7 the formula formula is working correctly for February. Is something wrong with the month code of "1" for January.
    Attached Files Attached Files

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Month Codes in formula

    Because Month(0) = 1
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Month Codes in formula

    Hi rhudgins.

    I noticed that there are some macros. I think that the problem is there.....

    I noticed that in AF column, even if is empty, the formula =month(af20)>(for example),gives 1 !!!!!

    So your formula regognize the empty cells as Jaunury!!!!

    I greated a helper column(AG) and put the formula =IF(AF20="";"";MONTH(AF20))

    Then in Monthly Pnl Sheet, used this formula. =SUMIF('All Closed Positions'!AG14:AG10000;A17)

    And works...!

    Hope to helps you.
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Month Codes in formula

    ....So simple Shg!!!!!!!!

    I spend more than twenty minutes on this.........!

    So not the macros......

    Keep teaching us!!

  5. #5
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Month Codes in formula

    Use TEXT function like,

    =SUMPRODUCT(--(TEXT('All Closed Positions'!$AF$14:$AF$10000,"m;;")=A6&""))

    So TEXT will format all the blank cells as "". Since you are on XL2010 you can use COUNTIFS for multi-conditional counting, SUMIFS for multi-conditional summing
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  6. #6
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Month Codes in formula

    But why is my formula recognizing the empty cells as January? I would rather not have to create a helper column so is there a way to get the formula to stop recognizing empty cells as January?

    Shg- I am not sure what you mean by Month(0) = 1? What change should I make?

  7. #7
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Month Codes in formula

    See DonkeyOte's explanation on this Thread

  8. #8
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Month Codes in formula

    Thanks. With that same logic how can I convert the formulas in cells D26, D29 and D34.

    Previosuly I used this sheet for 3/2011-12/2011. Now that I need to include January and it is not working, I am going to have to convert all of my old formulas. Ughhh

  9. #9
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Month Codes in formula

    See the post #5.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1