+ Reply to Thread
Results 1 to 6 of 6

Convert formulas to values based on dates

  1. #1
    Registered User
    Join Date
    02-06-2015
    Location
    Bad Muenstereifel, Germany
    MS-Off Ver
    7
    Posts
    12

    Convert formulas to values based on dates

    Hi all,

    I would like to take the formulas in a cell and convert that to a value based upon the current date - meaning everything older than today is just a number, not a formula.

    Background: This is a productivity report where completed tasks and hours are manually entered at the end of business and then run through a bunch of pivot tables. The dashboard page does a bunch of GETPIVOTDATA and everything is working like it should.

    However, we have a separate SQL that gives me real-time data and this is the data that I would like to see in the dashboard for today (the report doesn’t show me older than today or else the update would simply take too long and bog down the server.

    So what I need is a macro that will compare dates and anything older than today will be converted from a formula to a number.

    Dates are in row 1
    Data is in rows 2- 50

    In order to make it easy I've attached a dummy file with just one sheet and very basic formulas. It's the principle I'm interested in.

    I’ve tried to do the magic myself, but just can’t get it done and none of the macros I’ve found do what I want.
    I would appreciate help here.

    Cheers
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Convert formulas to values based on dates

    What does this mean?
    So what I need is a macro that will compare dates and anything older than today will be converted from a formula to a number.
    Give us an example of the number you would like. Any number? or a specific number?
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Convert formulas to values based on dates

    I think this will do the trick.
    Please Login or Register  to view this content.
    I changed the value in D1 to 9/20/16 so it had some older dates to work with. It worked fine on your data, converting all values from Rows 2:50 in that column to values.

  4. #4
    Registered User
    Join Date
    02-06-2015
    Location
    Bad Muenstereifel, Germany
    MS-Off Ver
    7
    Posts
    12

    Re: Convert formulas to values based on dates

    Hi jomili,

    thanks for the help. That does the trick.

    Could you Show me what I need to do in order to have 2 (or more) different ranges in the rows?
    For example, let the macro work on rows 5-6 and 15-17

    Cheers

  5. #5
    Registered User
    Join Date
    02-06-2015
    Location
    Bad Muenstereifel, Germany
    MS-Off Ver
    7
    Posts
    12

    Re: Convert formulas to values based on dates

    Oh yeah, almost Forget....

    the macro changes all old data including the current date. can you adapt it to change everything older than today but still keep the info from today?
    cheers

  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Convert formulas to values based on dates

    Okay, to change only the older dates all we have to do is change "<=" to "<", which I've done in the below code.
    On the ranges, assuming your data ranges are on the same sheet, I've done it below following my first example, for instance, you said "Data is in rows 2- 50".
    So, in the original code we follow the R1C1 (RowColumn) format, so when you see "Cells(X,R)", X is the Row number, R is value from 4-17 (column number). So I simply added another section that picks up with row 52 through 100. IF you have hard and fast data sets (Like Rows 2-50 and 52-100) this is the easiest way to go. However, if you have variable data sets (for instance, today it's Rows 2-47 and Rows 58-72, tomorrow it will be different) we'll need to tackle it a different way.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Convert Values to formulas
    By TSter in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-19-2021, 11:41 PM
  2. Replies: 26
    Last Post: 06-30-2015, 01:20 PM
  3. Replies: 18
    Last Post: 03-24-2013, 04:20 PM
  4. [SOLVED] Request a Macro to Convert data into Dates (Multiple Dates Values separated by Line)
    By seenai in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2012, 02:28 AM
  5. Convert formulas to values
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2011, 07:38 AM
  6. Convert IF formulas to their values
    By GregR in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-06-2006, 04:55 PM
  7. convert formulas to values
    By MatthewFlinchem in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-17-2006, 11:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1