Inserting Time Stamp beside a keyword.

ceclay

Board Regular
Joined
Dec 4, 2019
Messages
58
Office Version
  1. 2016
Platform
  1. Windows
I have this dynamic list of data in Power Query, I would like to ask if it is possible in power query to add a time stamp if the product become "Out of Stock". Below is a sample data. Can't do it on excel formula as the position of Product are moving to different rows


ProductAvailabilityTime Stamp
BarbequeAvailable
SaladOut of Stock
PastaAvailable
ChocolateAvailable
Fruit SaladOut of Stock
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    AddDateTime = Table.AddColumn(Source, "Time Stamp", each if[Availability]="Out of Stock" then DateTime.LocalNow() else null)
in
    AddDateTime
 
Upvote 0
Hi @alansidman ,
The problem with the above is the time will change every time I refresh the query. What I wanted if possible is the time stamp when a product changes from "Available" to "Out of Stock". Is that even possible?
 
Upvote 0
Instead of doing it in power query, do it in the source document with a VBA Change Event. That will only work if the out of stock is manually generated in an excel file. If the source file is somewhere else, not sure how that can be accomplished. Good Luck, unfortunately, I do not have a better solution.
EDIT:
I have googled this and found something that may be of interest, however

 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

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