+ Reply to Thread
Results 1 to 10 of 10

Find first cell value of current year

  1. #1
    Registered User
    Join Date
    03-20-2020
    Location
    Channelview, Texas
    MS-Off Ver
    MS Office Pro Plus 2019
    Posts
    8

    Find first cell value of current year

    Hello. First post. I have searched and searched but can't figure out how to solve my problem. I am tracking expenses of my vehicles. What I want to do is find the first occurrence of the "Mileage" figure for the year. That way, 2021 and other years will also have the first value found. Same goes for the last entry of the year.

    I have been using Vlookup and Lookup to find the values, and those formulas are working correctly. But, they are searching for the entire list of entries, and so far, it is just for the year 2020.

    So, How do I find the mileage for just this year (2020)? The formula should also work when I create columns for the next year. I have attached a sample of the expense sheet with the formula in question highlighted in blue.

    Note: I am using 2016 Home and student version so the latest functions like MINIFS don't work.

    All help and advice is appreciated.
    Thanks
    Mike
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Find first cell value of current year

    Hi Leroy and welcome to the forum,

    Excel has this tool called Pivot Tables that can break numbers out by day or month or quarter or year and do totals and subtotals on them AND so much MORE.
    Uber Stats.xlsm
    See the attached and search on Pivot Tables to see what they might do for you.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Find first cell value of current year

    Hey Leroy,
    I played with the Pivot a little (no formulas needed just drag and drop and right click on cells to display other stuff) See a new pivot.
    Uber Stats Mileage by Vehicle.xlsm
    Also I needed to repeat the Vehicle in Col C so it was "GOOD" table data. It is bad to leave blanks in a cell when you are trying to filter or sort by that data.
    Last edited by MarvinP; 03-20-2020 at 04:31 PM.

  4. #4
    Registered User
    Join Date
    03-20-2020
    Location
    Channelview, Texas
    MS-Off Ver
    MS Office Pro Plus 2019
    Posts
    8

    Re: Find first cell value of current year

    Thanks. I have never used pivot tables.

    All I really need is the mileage reading (from the odometer) from the first occurrence of the year. In the example sheet for the 15 Traverse, Vlookup found the mileage number in cell M20. Is there a way to modify the existing Vlookup formula to include the year? Something like the SUMIFS formula where the year is calculated (greater than 1/1/2020 and less than 12/31/2020) as used in cell I3 for the "gas" total. Note: The dates are in a range called Expense_Dates.

    I was hoping to use MINIFS and MAXIFS, but my version of Excel doesn't allow it.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Find first cell value of current year

    Hey Leroy,

    Pivot Tables has a "Min" feature where you don't need to show the Sum of Miles or Average of Miles, you can show the Min Odo Reading by date. No Formulas. I thought you could do MinIfs() . Sorry but see the attached Pivot Table
    Uber Start Yr Odo Reading.xlsm
    If you learned Pivots, you could do so much more with your data!!
    If you demand it, I could most likely write a MinIFS() formula for each vehicle but I'd need to use a helper.

  6. #6
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: Find first cell value of current year

    D3=SUMPRODUCT(($C$16:$C$63=$A$3)*(YEAR($B$16:$B$63)=I$2)*(INDEX($B$16:$T$63,0,MATCH($B3,$B$15:$T$15,0)))*($D$16:$D$63=LEFT($B3,7)))

    Copy down D3 -D4

  7. #7
    Registered User
    Join Date
    03-20-2020
    Location
    Channelview, Texas
    MS-Off Ver
    MS Office Pro Plus 2019
    Posts
    8

    Re: Find first cell value of current year

    Thanks for the help. I will do some research and learn more about pivot tables.

  8. #8
    Registered User
    Join Date
    03-20-2020
    Location
    Channelview, Texas
    MS-Off Ver
    MS Office Pro Plus 2019
    Posts
    8

    Re: Find first cell value of current year

    Quote Originally Posted by CARACALLA View Post
    D3=SUMPRODUCT(($C$16:$C$63=$A$3)*(YEAR($B$16:$B$63)=I$2)*(INDEX($B$16:$T$63,0,MATCH($B3,$B$15:$T$15,0)))*($D$16:$D$63=LEFT($B3,7)))

    Copy down D3 -D4
    Thanks. I will check that out.

  9. #9
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: Find first cell value of current year

    YEAR 2020

    MIN Milage for 15 Traverse


    D3=AGGREGATE(15,6,INDEX($B$16:$T$63,0,MATCH(B3,$B$15:$T$15,0))/(YEAR($B$16:$B$63)=$I$2)/($C$16:$C$63=$A$3)/($D$16:$D$63=LEFT(B3,7)),1)

    MAX Milage for 15 Traverse

    D4=AGGREGATE(14,6,INDEX($B$16:$T$63,0,MATCH($B4,$B$15:$T$15,0))/(YEAR($B$16:$B$63)=$I$2)/($C$16:$C$63=$A$3)/($D$16:$D$63=LEFT(B4,7)),1)


    The previous formula gave the sum not to consider it

  10. #10
    Registered User
    Join Date
    03-20-2020
    Location
    Channelview, Texas
    MS-Off Ver
    MS Office Pro Plus 2019
    Posts
    8

    Re: Find first cell value of current year

    Quote Originally Posted by CARACALLA View Post
    YEAR 2020

    MIN Milage for 15 Traverse


    D3=AGGREGATE(15,6,INDEX($B$16:$T$63,0,MATCH(B3,$B$15:$T$15,0))/(YEAR($B$16:$B$63)=$I$2)/($C$16:$C$63=$A$3)/($D$16:$D$63=LEFT(B3,7)),1)

    MAX Milage for 15 Traverse

    D4=AGGREGATE(14,6,INDEX($B$16:$T$63,0,MATCH($B4,$B$15:$T$15,0))/(YEAR($B$16:$B$63)=$I$2)/($C$16:$C$63=$A$3)/($D$16:$D$63=LEFT(B4,7)),1)


    The previous formula gave the sum not to consider it
    Thanks. I saw the total. I will check out these formulas. I really appreciate the help. I'm just an old retired guy that likes Excel...still feel like a rookie.

    EDIT:
    WOW! Perfect. Thank you so much. I am going to study those two formulas and try to learn more about how the result was obtained.
    Last edited by Leroy49; 03-20-2020 at 08:53 PM.

+ 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. Find dates in current year and previous year delete rows.
    By kreiner2006 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2019, 05:13 PM
  2. [SOLVED] Set PivotTable Filter to Current Day, Current Week, Current Month, or Current Year
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2014, 08:31 AM
  3. Replies: 3
    Last Post: 09-04-2013, 10:49 AM
  4. Display current year in cell
    By Wavin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-04-2013, 05:33 AM
  5. Replies: 1
    Last Post: 08-13-2012, 11:18 AM
  6. [SOLVED] Enter current year into a cell
    By mm5384 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-23-2012, 04:16 PM
  7. Replies: 4
    Last Post: 07-16-2012, 07:02 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