+ Reply to Thread
Results 1 to 3 of 3

Conditionally compare

  1. #1
    Forum Contributor
    Join Date
    07-28-2018
    Location
    India
    MS-Off Ver
    2013
    Posts
    173

    Conditionally compare

    Hi,

    I am looking for a macro that will first Inform me to put a file to a path & then only it will start the process & if i don't put the file in that path then that macro will not proceed it will keep informing to put that file
    Hardcode the path path of the file & name of the file in the macro itself so that i can change it as per my needs
    Macro will be placed in a master.xlsm
    there are 2 files name 1.csv & 2.xls
    we have to Match Column Aof 2.xls with Column A of 1.csv & if it matches then we have to compare column E of 1.csv with column C of 2.xls & if column E of 1.csv is greater than column C of 2.xls Then Buy in column D of 2.xls & if column E of 1.csv is smaller than column C of 2.xls Then put Sell in column D of 2.xls

    Thnx for the Help
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,946

    Re: Conditionally compare

    Not sure what you mean by putting a file into a path, but with both those files open, enter this into Cell D2 of 2.xlsm and copy down:

    =IFERROR(IF(VLOOKUP(A2,'1.csv'!$A:$F,5,FALSE)>C2,"Buy","Sell"),"")

    Not sure what you want to do if the prices are identical.... here is a macro to add the formula with 2.xlsm as the activeworkbook/worksheet:

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 06-22-2022 at 11:33 AM.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    07-28-2018
    Location
    India
    MS-Off Ver
    2013
    Posts
    173

    Re: Conditionally compare

    Thnx Alot Sir For ur Great Help

+ 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] vba excel - Conditionally compare values while writing an array
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-07-2020, 09:17 AM
  2. [SOLVED] Conditionally compare the data & delete entire row
    By dumdumbum in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-20-2020, 10:14 AM
  3. [SOLVED] Conditionally compare the data & delete entire row
    By dumdumbum in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-29-2020, 05:41 AM
  4. [SOLVED] How to compare cells and format conditionally over a whole sheet
    By HilaryP in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-30-2014, 10:33 AM
  5. Compare two files, move data conditionally
    By Marco-Kun in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-01-2011, 04:17 PM
  6. Replies: 5
    Last Post: 07-05-2011, 06:25 PM
  7. Access/Excel data to compare and sum conditionally
    By abhic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2005, 03:05 AM

Tags for this Thread

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