+ Reply to Thread
Results 1 to 6 of 6

Formula Macro to change cell value based on another cell

  1. #1
    Registered User
    Join Date
    01-21-2015
    Location
    newry
    MS-Off Ver
    2007
    Posts
    15

    Formula Macro to change cell value based on another cell

    I Have a spreadsheet of data exported from another system as csv file and then opened in excel, Column A contains transaction type and Column M equals transaction Value. The problem is that there is no sign on the transaction so debits and credits both show in column m as positive. I want a macro which can look at col A and if it equals PA value in col M = (Value *-1).

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Formula Macro to change cell value based on another cell

    A simple formula will do that. =IF(A2="PA",M2*-1,M2) copied down
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    01-21-2015
    Location
    newry
    MS-Off Ver
    2007
    Posts
    15

    Re: Formula Macro to change cell value based on another cell

    Sorry Glenn putting in the formula overwrites the current value and therefore changes value to 0. I need a temp variable to hold the cell value whilst applying the formulae but not sure how to code this.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Formula Macro to change cell value based on another cell

    You cant have a formula and a value in one cell. I'd intended thst you use it in the first empty column.

  5. #5
    Registered User
    Join Date
    01-21-2015
    Location
    newry
    MS-Off Ver
    2007
    Posts
    15

    Re: Formula Macro to change cell value based on another cell

    Sorry I wasn't clear I can't add any columns as the data is needed again with only the same no of columns, hence the need for macro,

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Formula Macro to change cell value based on another cell

    OK. Understood. I'm hopeless with macros. Over to others...

+ 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. Macro to Change Text Color to Red in Cell Based of Cell Value in Another Worksheet
    By jriemanx2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2016, 11:09 AM
  2. Using Macro to change cell color based on reference cell value in different sheet
    By Emma Ford in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2015, 03:51 AM
  3. Macro to change colour of cell based on finding a specific word in the cell
    By Shelby761 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2014, 09:46 AM
  4. Replies: 1
    Last Post: 12-19-2012, 05:29 PM
  5. Macro to change cell contents based on another cell in the same row
    By lanos in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2012, 10:11 AM
  6. [SOLVED] Macro to change values of a cell based off another cell
    By krazyjoker in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-27-2012, 12:45 AM
  7. Macro to Enter Text in Cell B based on Change in Cell A?
    By kaletag in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2012, 11:59 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