How to insert timestamp (IF NOW functions)

%3CLINGO-SUB%20id%3D%22lingo-sub-956613%22%20slang%3D%22en-US%22%3EHow%20to%20insert%20timestamp%20(IF%20NOW%20functions)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-956613%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20all!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIm%20having%20trouble%20with%20inserting%20timestamp%2C%20as%20is%3A%3C%2FP%3E%3CPRE%3E%3CSPAN%3E%3DIF(A2%26lt%3B%26gt%3B%22%22%2CIF(B2%26lt%3B%26gt%3B%22%22%2CB2%2CNOW())%2C%22%22)%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EThis%20formula%20should%20put%20timestamp%20in%20B2%20if%20any%20entry%20in%20A2%20is%20given%2C%20but%20I%20got%20error%20in%20result%20.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%3E%3DIF(A2%26lt%3B%26gt%3B%22%22%2CIF(AND(B2%26lt%3B%26gt%3B%22%22%2CCELL(%22address%22)%3DADDRESS(ROW(A2)%2CCOLUMN(A2)))%2CNOW()%2CIF(CELL(%22address%22)%26lt%3B%26gt%3BADDRESS(ROW(A2)%2CCOLUMN(A2))%2CB2%2CNOW()))%2C%22%22)%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3EAnd%20this%20one%20should%20update%20timestamp%20in%20B2%20when%20A2%20entry%20is%20updated%2C%20also%20error%20returns.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20am%20I%20doing%20wrong%2C%20please%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-956613%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eexcel%20if%20now%20timestamp%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-956764%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20insert%20timestamp%20(IF%20NOW%20functions)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-956764%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F246678%22%20target%3D%22_blank%22%3E%40dorepac%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENot%20sure%20you%20what%20you%20want%20to%20achieve%20with%20these%20formulae.%20TODAY()%20will%20update%20the%20timestamp%20every%20time%20you%20open%20the%20workbook%20or%20even%20when%20you%20enter%20something%20in%20any%20other%20cell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20anyhow%2C%20I%20copied%20them%20in%20a%20sheet%20of%20my%20own%20to%20see%20what%20they%20ar%20doing.%20At%20first%2C%20they%20just%20returned%20the%20value%20of%20cell%20B2.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERewrote%20your%20formulae%20to%3A%3C%2FP%3E%3CP%3E%3DIF(A2%26lt%3B%26gt%3B%22%22%2CIF(B2%26lt%3B%26gt%3B%22%22%2CNOW())%2C%22%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(A2%26lt%3B%26gt%3B%22%22%2CIF(AND(B2%26lt%3B%26gt%3B%22%22%2CCELL(%22address%22)%3DADDRESS(ROW(A2)%2CCOLUMN(A2)))%2CNOW()%2CIF(CELL(%22address%22)%26lt%3B%26gt%3BADDRESS(ROW(A2)%2CCOLUMN(A2))%2CNOW()))%2C%22%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethen%20these%20returned%20a%20timestamp%20based%20on%20NOW().%20All%20I%20did%20is%20delete%20both%20references%20to%20%22B2%22%20in%20the%20end%20of%20your%20formulae.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPerhaps%20this%20helps.%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%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-997696%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20insert%20timestamp%20(IF%20NOW%20functions)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-997696%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F246678%22%20target%3D%22_blank%22%3E%40dorepac%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBoth%20formulas%20return%20timestamp%2C%20here%20is%20result%20for%20second%20one%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20234px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F155961iF23089D5F2C81259%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eif%20only%20you%20enable%20iterative%20calculations%20in%20settings%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20788px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F155962i4482A2A12C925C9F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eotherwise%20it'll%20be%20circular%20reference%20error.%20But%20you%20shall%20be%20quite%20careful%20with%20this%20setting%20to%20avoid%20side%20effect%2C%20e.g.%20if%20another%20circular%20reference%20eventually%20appears%20in%20workbook%20you%20may%20miss%20it%20and%20have%20wrong%20result%20in%20calculations.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hello all!

 

Im having trouble with inserting timestamp, as is:

=IF(A2<>"",IF(B2<>"",B2,NOW()),"")

This formula should put timestamp in B2 if any entry in A2 is given, but I got error in result .

 

=IF(A2<>"",IF(AND(B2<>"",CELL("address")=ADDRESS(ROW(A2),COLUMN(A2))),NOW(),IF(CELL("address")<>ADDRESS(ROW(A2),COLUMN(A2)),B2,NOW())),"")

And this one should update timestamp in B2 when A2 entry is updated, also error returns.

 

What am I doing wrong, please help.

 

 

2 Replies

@dorepac 

Not sure you what you want to achieve with these formulae. TODAY() will update the timestamp every time you open the workbook or even when you enter something in any other cell.

 

But anyhow, I copied them in a sheet of my own to see what they ar doing. At first, they just returned the value of cell B2.

 

Rewrote your formulae to:

=IF(A2<>"",IF(B2<>"",NOW()),"")

 

and

 

=IF(A2<>"",IF(AND(B2<>"",CELL("address")=ADDRESS(ROW(A2),COLUMN(A2))),NOW(),IF(CELL("address")<>ADDRESS(ROW(A2),COLUMN(A2)),NOW())),"")

 

then these returned a timestamp based on NOW(). All I did is delete both references to "B2" in the end of your formulae.

 

Perhaps this helps.

 

 

 

 

 

 

 

@dorepac 

Both formulas return timestamp, here is result for second one

image.png

if only you enable iterative calculations in settings

image.png

otherwise it'll be circular reference error. But you shall be quite careful with this setting to avoid side effect, e.g. if another circular reference eventually appears in workbook you may miss it and have wrong result in calculations.