Year from date

jarhead58

Active Member
Joined
Sep 21, 2017
Messages
364
Office Version
  1. 2021
Platform
  1. Windows
Hey everyone!! Hope you all had a great holiday season!!

I have J4 set with "=Mode(B4:B105)" which column B contain various numbers. Column A cells are dates, (A4=1/1/2019, A5=12/28/2018....etc going backward) How can I change the value of J4 ":B105" to the column B cell number closest to a year from the date of A4 or is it not possible? TIA
 
Hi,

Try repeating the the Offset formula, changing the "B" to be the NEW column to include.

=MODE(OFFSET(B4,,,MATCH(EDATE(A4,-12),A4:A10000,-1)),OFFSET(C4,,,MATCH(EDATE(A4,-12),A4:A10000,-1)),OFFSET(D4,,,MATCH(EDATE(A4,-12),A4:A10000,-1)),OFFSET(E4,,,MATCH(EDATE(A4,-12),A4:A10000,-1)),OFFSET(F4,,,MATCH(EDATE(A4,-12),A4:A10000,-1)))

Gaz

Thanks for the reply! Just an fyi, which I should have mentioned, the other columns just contain numbers like in Column A! Would the EDate function still be necessary for C, D, E, and F? TIA
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
The Match(Edate part determines how many rows of data to be included, for each column.

What you could do (which i would do), is to put this part into a separate cell, then reference that cell, like

In Cell D1 put
=MATCH(EDATE(A4,-12),A4:A10000,-1)

Then your formula can reference that cell, like
=MODE(OFFSET(B4,,,D1),OFFSET(C4,,,D1),OFFSET(D4,,,D1),OFFSET(E4,,,D1),OFFSET(F4,,,D1))

hth
Gaz
 
Upvote 0
The Match(Edate part determines how many rows of data to be included, for each column.

What you could do (which i would do), is to put this part into a separate cell, then reference that cell, like

In Cell D1 put
=MATCH(EDATE(A4,-12),A4:A10000,-1)

Then your formula can reference that cell, like
=MODE(OFFSET(B4,,,D1),OFFSET(C4,,,D1),OFFSET(D4,,,D1),OFFSET(E4,,,D1),OFFSET(F4,,,D1))

hth
Gaz

This would work but after looking at the rest of my spreadsheet, I have so much going on with different formulas and references that it would probably be better left alone as is! If it ain't broke don't fix it lol! I was just trying to cut some of my manual entries down but that's ok, I can do this lol!! I'm sorry if I wasted your time in the process! Thank you so much for all of your help gaz, you were a great help!!
 
Upvote 0
You're welcome, no problem at all, better to look at dif options.

Just to clarify, you said "the other columns just contain numbers like in Column A", doesn't Col A contain dates? And the other columns just numbers! Just worried that I may have got the wrong end of the stick somewhere.

Gaz
 
Upvote 0
You're welcome, no problem at all, better to look at dif options.

Just to clarify, you said "the other columns just contain numbers like in Column A", doesn't Col A contain dates? And the other columns just numbers! Just worried that I may have got the wrong end of the stick somewhere.

Gaz

See, I told you I was old lol!! You're correct, it should have been like Column B!
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,286
Members
449,076
Latest member
kenyanscott

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