• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
You are here: Home
Lost password?
sp_Search
Advanced Search|Last Search Results
Advanced Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search

Please confirm you want to mark all posts read

Mark all topics read

sp_MobileMenu Actions
Actions
sp_LogInOut
Log In
sp_Search

Search Forums

sp_RankInfo
Ranks Information
Avatar

New/Updated Topics

General Excel Questions & Answers

  Calculate occurrences of max value by hour

  Lookup in a 3 Dimentional Table

  Amortization schedule with changing interest rate

  Exact Match searching, NOT partial.

Dashboards & Charts

  Connecting 2 separate pivot charts or data sets to calculate…

VBA & Macros

  IF and Max Formula through VBA

  VBA to Have Template file remain Open after Copy is Saved &a…

Power Query

  Using Table.ReplaceValue with Text.Combine to do an in place…

  Removing columns in Power BI source file

  How to add a new query for each cell of a column

  Creating a new table from other data sources

  Converting Values from positive to Negative in Power Query

  Running total in power query

Xtreme Pivot Tables

  Structuring data to drive pivot tables.

Power BI

  Plotting a line in a visual representing cumulate sum

Select Forum

  Rules and Guides

Forum Rules and Guides

  Public Forums - For Registered Users

General Excel Questions & Answers

Dashboards & Charts

VBA & Macros

Power Query

Power Pivot

  Course Members Only

Excel Dashboards

Power Query

Power Pivot

Xtreme Pivot Tables

Excel for Decision Making

Excel for Finance

Power BI

Excel

Word

Outlook

Excel Expert

Excel for Customer Service Professionals

Excel Analysis Toolpak

Excel Tables

Excel for Operations Management

Financial Modelling

Advanced Excel Formulas

Pivot Tables Quick Start

ForumsGeneral Excel Questions &…
sp_TopicIcon
Change excel cell from formula to value based on date
Avatar
KD Dh
Posts: 7
Level 0
January 28, 2020 - 8:37 am

1

Hi all,

Im having this issue on Excel:

- I have data that auto updates, so i need to change columns such that when a certain data passes, the cells in the column cannot change "are fixed and changed to values" instead of formulas.

 

is there a way i can do this?

Avatar
Philip Treacy
Posts: 1518
Level 10
January 28, 2020 - 8:55 am

2

Hi,

Please supply your workbook and data and a clearer explanation of what it is exactly you want to happen.  

Please supply as much information as possible e.g. :

1. How does your data auto-update?

2. How do you want to 'chnage columns'?

3. What 'certain data passes'?

4. etc

Regards

Phil

Avatar
KD Dh
Posts: 7
Level 0
January 28, 2020 - 9:10 am

3

Hi,

 

I cannot attach the full spreadsheet but have attached a snippet.

 

So i have the pivot table on the left where the "completed" column auto updates through a SQL macro everyday from an external source, that dosent really matter.

 

For example, i have a formula "I11-C11" to get a value for completed in that certain date. 

 

But what i want is that when that certain date passes, that column "I" automatically change from the formula to a fixed value that wont change.

Avatar
KD Dh
Posts: 7
Level 0
January 28, 2020 - 9:11 am

4

Spreadsheet-test.PNGImage Enlarger

sp_PlupAttachments Attachments
  • sp_PlupImage Spreadsheet-test.PNG (129 KB)
Avatar
Purfleet
England
Posts: 412

Level 4
January 28, 2020 - 4:49 pm

5

Its still not particularly clear as the we cant see the actual workbook, but something like this might work.

You need to create this sub in the Thisworkbook module in the VBA editor. Then when you open the work book it will check if the date in I2 is less than today and if so copy the data to text in the whole of column I

There are a couple of issues you might need to adjust for 

- Date formats can be a little painful in VBA, i am in the UK so we use DDMMYYYY which is what i have set mine for.
- I dont know where the date is in your worksheet or if it will change so you might need to adjust I2
- I guess that column I will need to change to J the next day/week/month?

It is possible to get around the above, but i would need to see the workbook to be of more help.

Private Sub Workbook_Open()

Dim R As Range

Set R = Range("i:i")

If Format(Now, "DD/MM/YYYY") > Format(Range("i1"), "DD/MM/YYYY") Then
R = R.Value
End If

End Sub

Avatar
Jon Parry
Posts: 1

Level 0
January 28, 2021 - 5:13 am

6

Thanks Purfleet,

This formula works great. New to macros here, is there a way to loop this instead of copying this for each column you want to apply this to?

For example, so I wouldn't have to do something like this for each column:

Private Sub Workbook_Open()

Dim R As Range

Set R = Range("i:i")

If Format(Now, "DD/MM/YYYY") > Format(Range("i1"), "DD/MM/YYYY") Then
R = R.Value
End If

Set R = Range("j:j")

If Format(Now, "DD/MM/YYYY") > Format(Range("j1"), "DD/MM/YYYY") Then
R = R.Value
End If

End Sub

Many thanks

 

UPDATE, used the following formula:

 

Dim cell As Range

On Error GoTo ErrorHandler

For Each cell In Range("i1:u1")
If cell.Value < Range("i11") Then
cell.Offset(4, 0).Value = cell.Offset(4, 0).Value
End If

Next cell

Exit Sub
ErrorHandler:
Exit Sub

End Sub

Forum Timezone:
Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)

Devices in use: Desktop (5), Phone (3)

Forum Stats:
Groups: 3
Forums: 24
Topics: 6223
Posts: 27295
Member Stats:
Guest Posters: 49
Members: 31920
Moderators: 3
Admins: 4
© Simple:Press

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.