+ Reply to Thread
Results 1 to 5 of 5

retroactively applying formulas to existing data

  1. #1
    Registered User
    Join Date
    12-06-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    retroactively applying formulas to existing data

    I need to apply a 19% discount to purchases of a certain type, from a certain supplier. There are hundreds of entries, and I would like to change this information using a macro instead of tediously going cell-by-cell and changing the information.

    Here is an image of my spreadsheet:

    excel.png

    I need to apply the discount to all purchases with the medium "Book" and the supplier "Dawson". I know I could perform this calculation in an adjacent column, but as you can see, the formatting of my spreadsheet would mean that I'd have to go inserting columns, and there are dozens of sections, before applying the formula, probably with an IF function.

    I tried recording a macro by simply altering one of these cells in the way that I would like (multiplying the existing value by 0.81) but it didn't work when I tried to apply it to other cells.

    Is there any way to do this?

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: retroactively applying formulas to existing data

    Try the following:

    Please Login or Register  to view this content.
    Select the range of cells containing values you wish to alter in this way, and run that code.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    12-06-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: retroactively applying formulas to existing data

    Brilliant, that worked like a charm!

    Thanks
    J.

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: retroactively applying formulas to existing data

    Quote Originally Posted by jacquelineb View Post
    Brilliant, that worked like a charm!

    Thanks
    J.
    Glad it helped.

    Do you follow how it works?

  5. #5
    Registered User
    Join Date
    12-06-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: retroactively applying formulas to existing data

    More or less, I can see that you are referencing cells in relation to the active one and specifying their values, then giving a command. I'm not very familiar with coding in this context but I certainly understand the structure of it.

    Thanks again, you've really helped me out!

+ 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. Applying Named Ranges to Existing Formulae
    By Usman_W in forum Excel General
    Replies: 3
    Last Post: 06-26-2012, 01:59 PM
  2. Applying formulas to lots of data
    By Trothwell in forum Excel General
    Replies: 5
    Last Post: 07-20-2009, 08:56 AM
  3. [SOLVED] Applying a template to an existing file
    By Frank Moore in forum Excel General
    Replies: 1
    Last Post: 11-09-2005, 05:50 PM
  4. [SOLVED] Applying formulas only to the subtotals of a data list
    By KG in forum Excel General
    Replies: 5
    Last Post: 09-10-2005, 08:07 PM
  5. Applying Existing Password to New Spreadsheet
    By Vic in forum Excel General
    Replies: 1
    Last Post: 01-26-2005, 09:06 PM

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