SOLVED

Autocopy data from a cell to another cell based on current date

%3CLINGO-SUB%20id%3D%22lingo-sub-2119498%22%20slang%3D%22en-US%22%3EAutocopy%20data%20from%20a%20cell%20to%20another%20cell%20based%20on%20current%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2119498%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20have%20two%20tables%20in%20one%20sheet%20which%20I%20wanted%20to%20use%20for%20monitoring%20daily%20gain%2F%20loss%20data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20%3CSTRONG%3E%3DTODAY()%3C%2FSTRONG%3E%20formula%20is%20in%20table%201%20(cell%20B3)%2C%20as%20well%20as%20the%20data%20from%20a%20specific%20cell%20(J17)%20that%20I%20want%20to%20copy%20everyday%20to%20table%202.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Gervie_1-1612904067702.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F253713iA59C49A6D9E6A18E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Gervie_1-1612904067702.png%22%20alt%3D%22Gervie_1-1612904067702.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3E%3CSTRONG%3ETable%202%3C%2FSTRONG%3E%20looks%20like%20this%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Gervie_0-1612903799337.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F253711iF89DA5DD444FDFFB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Gervie_0-1612903799337.png%22%20alt%3D%22Gervie_0-1612903799337.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ECell%20J7%20changes%20everyday.%20%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3ESo%2C%20what%20formula%20can%20I%20use%20to%20auto%20copy%20the%20cell%20J7%20on%20a%20daily%20basis%20and%20update%20the%20Table%202%20automatically%3F%26nbsp%3B%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2119498%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2146045%22%20slang%3D%22en-US%22%3ERe%3A%20Autocopy%20data%20from%20a%20cell%20to%20another%20cell%20based%20on%20current%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2146045%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F961340%22%20target%3D%22_blank%22%3E%40Gervie%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20example%20you%20have%20the%20date%20as%20Feb%2010.%20Where%20on%20sheet%202%20do%20you%20want%20to%20copy%20the%20value%20of%20J17%3F%3C%2FP%3E%3CP%3ECan%20you%20share%20your%20file%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPeter%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2146293%22%20slang%3D%22en-US%22%3ERe%3A%20Autocopy%20data%20from%20a%20cell%20to%20another%20cell%20based%20on%20current%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2146293%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F667968%22%20target%3D%22_blank%22%3E%40peteryac60%3C%2FA%3E!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20checking%20my%20query.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3E%3CFONT%20size%3D%222%22%3EPlease%20see%20the%20attached%20file.%20This%20is%20more%20or%20less%20how%20the%20data%20will%20looks%20like%2C%20but%20for%20confidentiality%2C%20I%20replaced%20the%20content%2C%20so%20please%20do%20not%20mind%20if%20there%20are%20miscalculations%20as%20I%20just%20input%20whatever%20came%20to%20mind.%20%3C%2FFONT%3E%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnyway%2C%20there%20are%202%20tables%20on%20the%20same%20sheet.%26nbsp%3B%3CBR%20%2F%3EIn%20%3CSTRONG%3ETable%201%3C%2FSTRONG%3E%2C%20the%20percentage%20data%20(10.59%25)%20on%20cell%20%3CSTRONG%3E'J17'%3C%2FSTRONG%3E%20is%20reflected%20on%20the%20cell%20%3CSTRONG%3E'P27'%20%3C%2FSTRONG%3Eon%3CSTRONG%3E%20Table%202.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CEM%3EThe%20condition%20is%20%3CSTRONG%3Eif%20the%20date%20is%20Today%3C%2FSTRONG%3E%20(cell%20%3CSTRONG%3E'B3'%3C%2FSTRONG%3E)%2C%20the%20corresponding%20date%20on%20Table%202%20should%20automatically%20update%2F%20copy%20the%20value%20on%20J17.%26nbsp%3B%3C%2FEM%3E%26nbsp%3BThe%20variable%20is%20the%20value%20on%20J17%20coz%20that%20changes%20everyday.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESimply%20put%2C%20since%20today%20is%20February%2018%2C%202021%2C%26nbsp%3Bcell%20%3CSTRONG%3E'P27'%3C%2FSTRONG%3E%26nbsp%3B(which%20is%20Feb.%2018%20as%20well)%20copied%20the%2010.59%25%26nbsp%3B%20from%20J17.%20On%20Feb.%2019%2C%20%3CSTRONG%3E'P27'%20data%20must%20not%20change%2C%20but%20P28%20should%20copy%20the%20new%20value%20on%20J17%20instead.%20%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20current%20formula%20is%26nbsp%3B%3CEM%3E%3DIF(%24B%243%3DTODAY()%2C%24J%2417%2C0)%2C%26nbsp%3B%3C%2FEM%3Ebut%20by%20using%20this%2C%20if%20the%20day%20changes%20to%20Feb.%2019%2C%202021%2C%20cell%20'P27'%20will%20be%20the%20same%20with%20cell%20'P28.'%20I%20want%20it%20to%20stay%20as%2010.59%25%2C%20so%20I%20could%20see%20how%20the%20%22Portfolio%20Gain%22%20is%20progressing%20on%20a%20daily%20basis.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20my%20explanation%20didn't%20confuse%20you%2C%20and%20I%20also%20hope%20you%20could%20help%20me%20come%20up%20with%20a%20formula%20to%20automate%20this%20data.%26nbsp%3BLooking%20forward%20to%20your%20reply.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E-%20Gervie%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Gervie_0-1613657091892.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F255775i84BA6E31687004C0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Gervie_0-1613657091892.png%22%20alt%3D%22Gervie_0-1613657091892.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Gervie_1-1613657207019.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F255776iE649D91C1A9179C5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Gervie_1-1613657207019.png%22%20alt%3D%22Gervie_1-1613657207019.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello,


I have two tables in one sheet which I wanted to use for monitoring daily gain/ loss data.

 

The =TODAY() formula is in table 1 (cell B3), as well as the data from a specific cell (J17) that I want to copy everyday to table 2. 

 

Gervie_1-1612904067702.png

 

Table 2 looks like this:

Gervie_0-1612903799337.png

 

Cell J7 changes everyday.

So, what formula can I use to auto copy the cell J7 on a daily basis and update the Table 2 automatically? 

 

5 Replies

@Gervie 

 

In the example you have the date as Feb 10. Where on sheet 2 do you want to copy the value of J17?

Can you share your file?

 

thanks

 

Peter

Hello, @peteryac60!

 

Thank you for checking my query. 

Please see the attached file. This is more or less how the data will looks like, but for confidentiality, I replaced the content, so please do not mind if there are miscalculations as I just input whatever came to mind.

 

Anyway, there are 2 tables on the same sheet. 
In Table 1, the percentage data (10.59%) on cell 'J17' is reflected on the cell 'P27' on Table 2.

The condition is if the date is Today (cell 'B3'), the corresponding date on Table 2 should automatically update/ copy the value on J17.  The variable is the value on J17 coz that changes everyday.

 

Simply put, since today is February 18, 2021, cell 'P27' (which is Feb. 18 as well) copied the 10.59%  from J17. On Feb. 19, 'P27' data must not change, but P28 should copy the new value on J17 instead.

 

My current formula is =IF($B$3=TODAY(),$J$17,0), but by using this, if the day changes to Feb. 19, 2021, cell 'P27' will be the same with cell 'P28.' I want it to stay as 10.59%, so I could see how the "Portfolio Gain" is progressing on a daily basis.

 

I hope my explanation didn't confuse you, and I also hope you could help me come up with a formula to automate this data. Looking forward to your reply. 

- Gervie 

 

Gervie_0-1613657091892.png

 

Gervie_1-1613657207019.png

 

 

 

 

 

Best Response confirmed by Gervie (New Contributor)
Solution

@Gervie 

Hi

 

Ok - I understand the problem now.

 

Using TODAY() will never work as you already spotted when you move to the next day the previous days data is overwritten.

 

The question I have for you is how important is for you to have an automated process to achieve this? It seems to me simpler for you to copy/paste the value in the appropriate cell in Table 2?

 

What you want can be achieved via some VBA coding - but I think it is using a sledgehammer cracking a nut!

 

I attach an example which includes some very crude code to copy cell J17 to the cell for Feb 18 (p27).

If you clear the date in cell P27 and go to another sheet (sheet3) and then select sheet2 cell P27 will be populated with J17 data.

 

At the moment this only works for cell P27. The code would need to be amended to find the appropriate cell each day (based on the current date) in order to  paste the data. 

I think this is too complicated to achieve - a simple copy / paste each day is simpler.

sorry!

 

Peter

 

 

 

 

 

 

 

Hi again, @peteryac60!

 

I understand.

For now, since this is for personal use, I could go on without the automation, but I might encounter the same for work purposes in the future. Actually, copy-pasting the previous data on a daily basis is exactly what I am doing in the sheets. I've been thinking all this time that there might be a simple formula that I could use, but at least now, I know that this is more complicated than I thought, and it would require me a VBA coding. I tried your instruction to clear P27, go to sheet 3, and rechecked P27. Indeed, the cell was auto-populated, and I'm amazed.   

 

I guess I'll stick with manual copy-paste while I'm trying to learn more on VBA, and gain more skills like yours. Really appreciate your time and effort to respond. Thanks a lot, Peter! Cheers, and stay safe.

 

 

 

 

 

 

@Gervie 

 

Hi

 

In order to access VBA you will need to add the developer tab to your ribbon.

Select anywhere on the ribbon and right click. You should see 'customize the ribbon' option. Select this and a window will pop up. Under the main tab section (a little more than halfway) is a 'developer' option. Check the box.  Then hit OK. The developer tab will appear on the ribbon. This is just the fist step to VBA!

Get yourself a simple VBA book or look at YouTube - thee are some good tutorials there.

BTW - I am not sure if you noticed but the file I sent you had a "xlms" suffix as opposed to "xlsx". VBA will only work on "xlms" files!

 

If you are happy with the 'solution' I provided can you please mark this as complete.

 

many thanks and good luck!

 

Peter