+ Reply to Thread
Results 1 to 8 of 8

IF function output

  1. #1
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    228

    IF function output

    I have 3 columns - A(text), B(Date), and C(number). Here is an example of what I would like: If column A says "redemption" and column B says "5/3/2010" then I would like column C to be copied and pasted into a cell in another spreadsheet.

    Part of the problem is that none of the columns are in order. Column A has 4 different categories and column B has any date from 5/1/10 to 5/31/10 (and there can be multiples or none of a certain date).

    I understand the whole idea of the IF function but I don't know how to get column C pasted into a different cell.

    So if 3 different rows, lets say row 3, 7, and 10 fit the IF expectations of =redemption and =5/3/2010, how do I copy and sum C3, C7, and C10 into (random choice) F11 of another spreadsheet?

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: IF function output

    Add this UDF to your destination workbook: ALT|F11, Insert|Module


    Please Login or Register  to view this content.

    Then apply formula in F11 like:

    Please Login or Register  to view this content.
    addjusting ranges, workbook and sheetnames and paths.

    Then confirm it with CTRL+SHIFT+ENTER not just ENTER
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    228

    Re: IF function output

    Thank you for your quick reply NBVC.

    I'm still a little confused though. I have never really worked with macros so i'm not sure what to do with all that code. Could you please explain it a little further?

    Thanks again.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: IF function output

    In your desination workbook (the work book you want the result in), hold the Alt key down and press F11. Then go to Insert and select Module.

    Then copy the code in in the first frame above into the white editor area.

    Then close that window and paste the formula in cell F11 (or where you want the result).

    Then change the path and workbook name, sheet name and cell ranges to match where you are trying to extract the data from.

    Then hold the Ctrl and Shift keys down and hit Enter.

    This should make the formula get surrounded by { } brackets and you should see results... hopefully what you expect to see.

  5. #5
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    228

    Re: IF function output

    I am only using 1 workbook so I put the module into the workbook I am using, then I copied the formula and put it into the cell I'd like the information to show up in. The only change I made to the forumula was that I took out the "C:\My Documents\[Book6.xls]" before each range of cells. The raw data is in "Sheet1" of the workbook so I left that part in.

    When I press Shift+Ctrl and then hit enter nothing happens.

    Right now, the final output is just a blank cell.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: IF function output

    Don't you have to reference the other workbook somehow? Or is it within the same workbook?

  7. #7
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    228

    Re: IF function output

    Okay, I've got the formula to work where I am getting the numbers I need.

    My new problem is that I need all of the instances to SUM into 1 cell. Right now I am getting so that it looks like: "-15673.15, -1000" I need it to just come out as "-16673.15"

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: IF function output

    Well then, that is a lot simpler. Your initial post lead me to believe you were copying text strings or numbers into one cell separated by commas...

    In this case you don't even need the vba udf... you only need to use SUMPRODUCT

    eg.

    =SUMPRODUCT(--(Sheet1!$A$1:$A$9="redemption"),--(Sheet1!$B$1:$B$9=DATE(2010,5,13)),Sheet1!$C$1:$C$9)

    or if you have XL2007 then SUMIFS

    =SUMIFS(Sheet1!$C$1:$C$9,Sheet1!$A$1:$A$9,"redemption",Sheet1!$B$1:$B$9,DATE(2010,5,13))

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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