+ Reply to Thread
Results 1 to 7 of 7

If Statement checking range of cells

Hybrid View

  1. #1
    Registered User
    Join Date
    03-02-2010
    Location
    Carmel, CA
    MS-Off Ver
    Excel 2008 for MAC
    Posts
    4

    If Statement checking range of cells

    I'll try to explain my question as best as possible.
    I have a spreadsheet of books sold at different discount levels. So colA = Discount level, colB = Title, ColC = Quantity sold.

    The formula I'm trying to get is to return the quantity in ColC if ColA=.35 and ColB='examplebooktitle1'

    I want the formula to scan a range of cells to match the criteria and when a match is found to return the value in ColC for that Row.

    The report I receive is different month to month as different discounts are used each time, as well I'm using a MAC for this project and thus am not able to write this in VBA.

    Thanks for any help,

    Chris

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: If Statement checking range of cells

    Chris

    You could put the following formula in column D and then sum column D

    =IF(AND($A2=35,$B2="examplebooktitle1"),$C2,"")

    Dion

  3. #3
    Registered User
    Join Date
    03-02-2010
    Location
    Carmel, CA
    MS-Off Ver
    Excel 2008 for MAC
    Posts
    4

    Re: If Statement checking range of cells

    Dion, thank you for your suggestion, that is originally where I started.

    Here is a little more information on what I'm doing. I pull reports out of an SQL query and put the results into my excel workbook. I am then trying to place this information into another sheet that I have already created which has separate columns for the different discount rates. From month to month the discounts returned on the SQL report will be different, sometimes a 35% or others a 10%. so locking in a row for a certain return.

    So again I need Sheet 1, for discount level @ 10%, I need to pull from sheet 2 the quantity sold(ColC), IF discount(Sheet2!ColA) = .10 and the title(Sheet2!ColB) = "examplebooktitle1"

    The formula would need to search the entire range of cells for a match where ColA and ColB both match and then if true would return for ColC in that row, if False it would only return 0.

    Thus why I can't lock it in as you suggested to search only Row2.

    Thanks,

    Chris

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: If Statement checking range of cells

    Hi

    Can you attach an example workbook so we can get a better idea of your structure.

    Also, give an expected result for some of the sample data.

    rylo

  5. #5
    Registered User
    Join Date
    03-02-2010
    Location
    Carmel, CA
    MS-Off Ver
    Excel 2008 for MAC
    Posts
    4

    Re: If Statement checking range of cells

    OK, I was able to create a sample report, based on what I am trying to accomplish, find that attached.

    So the order in which this works is this:

    1. I import data from an SQL query for a month into the Sheet 'SQL Month X'. I do these reports quarterly so there are 3 Sheets, one for each month.
    2. I am then trying to pull this data into another report, Sheet labeled 'Month 1'. This sheet combines the SQL data as well as data from other spreadsheets.
    3. So the main problem is that from month to month the SQL report is not consistent in the amount of data I receive, So what I am trying to do is write a formula that searches multiple cells for data. Saying basically if search range for Book Title(Col B) @ discount level (Col A) and if match is found then report Quantity sold (Col C).

    4. This needs to be done for multiple titles at multiple discounts.

    Again thanks for any help, I greatly appreciate it.

    Chris
    Attached Files Attached Files
    Last edited by Lockeitivity; 03-15-2010 at 01:02 PM.

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: If Statement checking range of cells

    Hi

    Has the data in SQL - Month 1!B:B (ie the title) been "doctored" at all, or is this how it comes in from the sql query? It is quite different in format from the data in SQL - Month 2.

    rylo

  7. #7
    Registered User
    Join Date
    03-02-2010
    Location
    Carmel, CA
    MS-Off Ver
    Excel 2008 for MAC
    Posts
    4

    Re: If Statement checking range of cells

    The information you need is in Month 1, I adjusted the data as not to include any personal information. However this should not effect the formula.

    Thanks

    Chris

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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