+ Reply to Thread
Results 1 to 10 of 10

return blank value if it is the last unique value in a column

  1. #1
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    return blank value if it is the last unique value in a column

    I'm working on an all encompassing, fully automated budget spanning multiple workbooks. My question involves a very specific portion of this though. I have a list of dated transactions all in order, and one of my helper columns converts the date to the month's text. =TEXT(A1,"mmm") For one of my formulas, I need to make sure the current partial month isn't included. The easiest way would seem to be to have this helper column be blank if it's the last value listed. For example, imagine the following list in columns A & B. How would you make it so March doesn't show up until you enter a non-March date below it in Column A?

    1/1/2015 Jan
    1/10/2015 Jan
    1/15/2015 Jan
    1/20/2015 Jan
    1/25/2015 Jan
    2/1/2015 Feb
    2/5/2015 Feb
    2/20/2015 Feb
    2/25/2015 Feb
    2/28/2015 Feb
    3/1/2015 Mar
    3/3/2015 Mar
    3/10/2015 Mar
    3/20/2015 Mar

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: return blank value if it is the last unique value in a column

    I should add that it's perfectly fine if I need another helper column for this.

  3. #3
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: return blank value if it is the last unique value in a column

    You could try:

    =IF(MONTH(A1)>=MONTH(TODAY()),"",TEXT(A1,"mmm"))

    - Moo

  4. #4
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: return blank value if it is the last unique value in a column

    I'm hoping there would be a way without going off of the current date. The transactions are downloaded and entered in batches with some buffer time. So even if it's April when I'm looking at it, March may still be incomplete data-wise.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: return blank value if it is the last unique value in a column

    I would take a different approach.

    Insteasd of converting the date to a month name, why not just use the date itself? This would eliminate the problem of (possibly?) including Jan 14 with Jan 15, and it should be a relativly simple matter to test for values using something like...
    Range<=EOMONTH(TODAY(),-1)...2/28/2015
    range>EOMONTH(TODAY(),-2)...1/31/2015

    If you dont want to use TODAY(), you could specify a start date and base off that
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: return blank value if it is the last unique value in a column

    OK, how about:

    =IF(MONTH(A1)<MONTH(MAX(A:A)),TEXT(A1,"mmm"),"")

    - Moo

  7. #7
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: return blank value if it is the last unique value in a column

    The formula that I'm using this for, is to calculate the daily spending average for a particular month and spending category. So I want to include all years, and I don't want to have to define the years because it will be continually updated. Here's a very generic example of what I'm using this for. This example doesn't include spending categories though.

    http://www.excelforum.com/excel-form...ral-years.html

    In that example it sums all February spending, and divides by the total days for the Februaries that had spending. One of those Februaries had a leap year. In this next example attached below, I've changed some of my helper columns to fix the number of days side of the equation. As you can see in row 3656, the total days for March 2015 aren't listed because it isn't complete. Now I just need to not include March 2015 on the spending side until a transaction greater than or equal to 4/1/2015 is entered. As I just typed that though, I think I have an idea. I've gotta run for a bit, but may have something figured out when I get back...

    bookone2.xlsx
    Last edited by smatchymo; 03-22-2015 at 05:48 PM.

  8. #8
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: return blank value if it is the last unique value in a column

    Thanks Moo!! Tested, working, and now I'm out of the house with nothing on my mind!

  9. #9
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: return blank value if it is the last unique value in a column

    Glad to help.

  10. #10
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: return blank value if it is the last unique value in a column

    Whoops, sorry Moo. I gave you some false credit. I was in such a hurry to leave that I didn't fully check it out. It removed a lot more than just March 2015. All is well though. As soon as I typed "now I just need to not include March 2015 on the spending side until a transaction greater than or equal to 4/1/2015 is entered," I knew what I needed to do.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula to return single unique value from column
    By excelji in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-28-2014, 02:32 PM
  2. Replies: 8
    Last Post: 02-13-2014, 11:30 AM
  3. [SOLVED] Return unique values based on another column's value
    By bd528 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-26-2013, 04:02 AM
  4. [SOLVED] Assigning a unique value to all blank cells in a column
    By mohammedfaizal in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-14-2013, 09:41 AM
  5. [SOLVED] How do I return the unique entries from a column to a listbox
    By Dave Mc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-09-2005, 04:06 AM

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