+ Reply to Thread
Results 1 to 9 of 9

If/Then (For Rows in Column A containing year, multiply corresponding cells in Column C)

  1. #1
    Registered User
    Join Date
    12-30-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    17

    If/Then (For Rows in Column A containing year, multiply corresponding cells in Column C)

    I'd like to perform the product function for cells in the rows that contain the year 2016. I tried the following code but it just returns FALSE. My thinking: if the year of the date in column A contains "2016", then multiply the corresponding cells in column A for these rows. Any suggestions?


    Please Login or Register  to view this content.
    Thanks!

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: If/Then (For Rows in Column A containing year, multiply corresponding cells in Column

    Hello
    Try using SUMPRODUCT, for example:

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


    This assumes that column A is actual dates and not text.

    DBY

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If/Then (For Rows in Column A containing year, multiply corresponding cells in Column

    One way...

    A1 = 1/1/2016
    B1 = 12/31/2016

    =SUMIFS(C25:C336,A25:A336,">="&A1,A25:A336,"<="&B1)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    12-30-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    17

    Re: If/Then (For Rows in Column A containing year, multiply corresponding cells in Column

    @DBY, That formula works great. The only thing is that I need to use the product(range+1)-1) formula to deal with the return series. Is there a way to incorporate this?

    Also it might be the most efficient to extract just the year as I'm dealing with a steam of returns going back to the 90s and the spreadsheet is data intensive as is so trying to avoid extra columns.
    Last edited by TIFinance; 06-08-2016 at 02:24 PM.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: If/Then (For Rows in Column A containing year, multiply corresponding cells in Column

    Try

    =IF(YEAR(A25:A336)=2016,PRODUCT(C$25:C$336)-1)

    Enter with Ctrl+Shift+Enter

  6. #6
    Registered User
    Join Date
    12-30-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    17

    Re: If/Then (For Rows in Column A containing year, multiply corresponding cells in Column

    @John, this is returning "false" which may be because I have dates going back further than 2016.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: If/Then (For Rows in Column A containing year, multiply corresponding cells in Column

    The formula only extracts data for 2016 so other data is not relevant. You will get FALSE if there is no data for 2016.

  8. #8
    Registered User
    Join Date
    12-30-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    17

    Re: If/Then (For Rows in Column A containing year, multiply corresponding cells in Column

    True, however, the "false" is overriding the "true". Since there is at least one "false" in the array, the entire formula isn't returning a product for any of the 2016 data. I'm currently returning a "false" until I adjust the range to only include rows where there are 2016 dates.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If/Then (For Rows in Column A containing year, multiply corresponding cells in Column

    So, I guess I misunderstood what you wanted?

+ 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. Replies: 7
    Last Post: 08-09-2015, 05:07 PM
  2. [SOLVED] VBA Insert multiply rows and Transpose from Row to Column
    By TCookie in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-14-2015, 02:44 PM
  3. Replies: 2
    Last Post: 11-26-2014, 12:41 PM
  4. Replies: 8
    Last Post: 09-16-2014, 09:49 AM
  5. Replies: 4
    Last Post: 09-03-2014, 02:57 AM
  6. Replies: 6
    Last Post: 01-26-2012, 09:15 PM
  7. Replies: 8
    Last Post: 08-06-2009, 09:02 AM

Tags for this Thread

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