Home

Last week with data reported monthly

%3CLINGO-SUB%20id%3D%22lingo-sub-790182%22%20slang%3D%22en-US%22%3ELast%20week%20with%20data%20reported%20monthly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-790182%22%20slang%3D%22en-US%22%3E%3CP%3ESo%20I%20have%20a%20sheet%20that%20is%20updated%20weekly.%20In%20version%201%20tab%2C%20cell%20a1%2C%20this%20is%20where%20I%20manually%20input%20the%20date.%20From%20there%2C%20cells%20A6-A53%2C%20it%20dates%20back%20two%20years%20(Sep%20-17%20cell%20A6)%20and%20goes%20forward%20two%20years%20(Aug%2021-A53)%20on%20a%20monthly%20basis.%26nbsp%3B%20Version%202%20tab%20is%20the%20same%20thing%20but%20I%20wanted%20to%20show%20that%20the%20dates%20change.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESheet%205%20reflects%20the%20data%20that%20is%20manually%20input%20BY%20WEEK.%20I%20put%20in%20data%20every%20week%20and%20at%20the%20end%20of%20each%20month%2C%20I%20use%20the%20last%20week%20of%20data.%20For%20example%2C%20Sheet%205%20for%20Sept%202017%20cells%20A376-A380%2C%20I%20have%205%20weeks%20of%20data%20Sept%201st%2C%20Sept%208th%2C%20Sept%2015th%2CSept%2022nd%2C%20and%20Sept%2029th.%20So%20for%20Sep%202017%20that%20is%20reflected%20on%20version%201's%20tab%20cell%20a6%20%2C%20I%20would%20like%20to%20use%20the%20last%20week%20of%20data%20which%20is%20the%2029th%20of%20Sept%203552.%20So%20in%20hindisght%2C%20I%20would%20like%20to%20pull%20the%20last%20week%20of%20data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20b%2Fc%20I%20am%20updating%20and%20reporting%20this%20information%20weekly%2C%20sometimes%20the%20monthly%20data%20is%20not%20completely%20full%20and%20I%20would%20have%20to%20use%20the%20last%20week%20of%20data%20that%20was%20reported%20until%20the%20data%20is%20filled%20in%20monthly.%20This%20is%20the%20area%20that%20I%20am%20having%20trouble%20in.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFirst%2C%20I%20need%20a%20formula%20that%20would%20pull%20the%20last%20week%20of%20the%20monthly%20data%20and%20if%20that%20is%20not%20available(if%20blank)%20use%20the%20week%20of%20data%20that%20is%20available.%20For%20example%2C%20sheet%205%20cell%20A476%2C%20the%20only%20available%20data%20is%20the%202-aug-19%20and%20I%20would%20like%20that%20data%20to%20be%20pulled%20instead%20of%20the%20blank%20data%20for%2030-Aug-19.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESecond%2C%20the%20formula%20that%20I%20tried%20to%20use%2C%20it%20is%20pulling%20the%20first%20week%20of%20data%20instead%20of%20the%20last%20week%20of%20data.%20I%20have%20highlighted%20the%20areas%20of%20concern%20and%20I%20have%20input%20comments.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESorry%20for%20the%20long%20post.%20Your%20response%20will%20be%20greatly%20appreciated.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-790182%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-791438%22%20slang%3D%22en-US%22%3ERe%3A%20Last%20week%20with%20data%20reported%20monthly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-791438%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F387930%22%20target%3D%22_blank%22%3E%40kfb041720144%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat%20could%20be%20like%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-ruby%22%3E%3CCODE%3E%3D(EOMONTH(TODAY()%2C0)%2B1%26gt%3B%3DA6)*LOOKUP(2%2C1%2F(Sheet5!C%3AC%26gt%3B0)%2F(A6%26gt%3B%3DSheet5!A%3AA)%2CSheet5!C%3AC)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-792335%22%20slang%3D%22en-US%22%3ERe%3A%20Last%20week%20with%20data%20reported%20monthly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-792335%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F387930%22%20target%3D%22_blank%22%3E%40kfb041720144%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20VLOOKUP%20retrieves%20the%20value%20of%20the%20last%20date%20that%20is%20equal%20(or%20less%20than)%20the%20%3CSTRONG%3Efirst%20day%20of%20each%20month%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3EYour%20omission%20of%20the%20range_lookup%20argument%20defaults%20to%20TRUE%20(or%20Approximate%20match)%2C%20which%20is%20the%20reason%20for%20the%20%22equal%20(or%20less%20than)%22%20part%20of%20my%20foregoing%20statement.%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20your%20lookup_value%20argument%20is%20the%20first%20day%20of%20each%20month%2C%20as%20I%20stated%20above.%20The%20formula%20you%20need%20must%20retrieve%20the%20value%20of%20the%20last%20date%20that%20is%20equal%20(or%20less%20than)%20the%20%3CSTRONG%3Elast%20day%20of%20each%20month%3C%2FSTRONG%3E.%20Such%20formula%20in%20Version%201!D6%20of%20the%20attached%20file%20is%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DLOOKUP(2%2C1%2F(%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E(Sheet5!A%3AA%26lt%3B%3DEOMONTH(A6%2C0))*(Sheet5!C%3AC%26lt%3B%26gt%3B%22%22))%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3ESheet5!C%3AC)%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-796179%22%20slang%3D%22en-US%22%3ERe%3A%20Last%20week%20with%20data%20reported%20monthly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-796179%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%26nbsp%3B%2C%20it%20doesn't%20return%20zero%20for%20the%20months%20without%20any%20data%3C%2FP%3E%3C%2FLINGO-BODY%3E
kfb041720144
Occasional Visitor

So I have a sheet that is updated weekly. In version 1 tab, cell a1, this is where I manually input the date. From there, cells A6-A53, it dates back two years (Sep -17 cell A6) and goes forward two years (Aug 21-A53) on a monthly basis.  Version 2 tab is the same thing but I wanted to show that the dates change.

 

Sheet 5 reflects the data that is manually input BY WEEK. I put in data every week and at the end of each month, I use the last week of data. For example, Sheet 5 for Sept 2017 cells A376-A380, I have 5 weeks of data Sept 1st, Sept 8th, Sept 15th,Sept 22nd, and Sept 29th. So for Sep 2017 that is reflected on version 1's tab cell a6 , I would like to use the last week of data which is the 29th of Sept 3552. So in hindisght, I would like to pull the last week of data.

 

However, b/c I am updating and reporting this information weekly, sometimes the monthly data is not completely full and I would have to use the last week of data that was reported until the data is filled in monthly. This is the area that I am having trouble in. 

 

First, I need a formula that would pull the last week of the monthly data and if that is not available(if blank) use the week of data that is available. For example, sheet 5 cell A476, the only available data is the 2-aug-19 and I would like that data to be pulled instead of the blank data for 30-Aug-19. 

 

Second, the formula that I tried to use, it is pulling the first week of data instead of the last week of data. I have highlighted the areas of concern and I have input comments. 

 

Sorry for the long post. Your response will be greatly appreciated. 

3 Replies

@kfb041720144 

That could be like

=(EOMONTH(TODAY(),0)+1>=A6)*LOOKUP(2,1/(Sheet5!C:C>0)/(A6>=Sheet5!A:A),Sheet5!C:C)

 

@kfb041720144 

Your VLOOKUP retrieves the value of the last date that is equal (or less than) the first day of each month.

Your omission of the range_lookup argument defaults to TRUE (or Approximate match), which is the reason for the "equal (or less than)" part of my foregoing statement. 

Also, your lookup_value argument is the first day of each month, as I stated above. The formula you need must retrieve the value of the last date that is equal (or less than) the last day of each month. Such formula in Version 1!D6 of the attached file is: 

=LOOKUP(2,1/(
(Sheet5!A:A<=EOMONTH(A6,0))*(Sheet5!C:C<>"")),
Sheet5!C:C)

@Twifoo , it doesn't return zero for the months without any data

Related Conversations
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies