+ Reply to Thread
Results 1 to 10 of 10

Adding more conditions to this formula

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Adding more conditions to this formula

    I have a formula to look up another workbook and give me how many in colum A say Yes =sumproduct(countif(indirect("'"&$g$1:$g$3&"'!a:a"),"yes"))
    you put the workbook names in g1:g3, I was looking to add to the formula to find out how many B:B = CAR and so on but they have to say both on the same row to count as one .

  2. #2
    Forum Contributor
    Join Date
    11-05-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    229

    Re: Adding more conditions to this formula

    If you are using Excel 2007 or later, you could use Countifs.

    If you want to use sumproduct, your formula would be something like:
    =sumproduct(--(indirect("'"&$g$1:$g$3&"'!a:a")="yes"),--(indirect("'"&$g$1:$g$3&"'!b:b")="car")

    Don't forget to click the little star to the left of this post if you feel I helped!
    Taming the Excel dragon... www.TheExcelphile.com

  3. #3
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Adding more conditions to this formula

    Hi The Excelphile I tried the formula example you gave me but it kept saying VALUE# in the cell.

  4. #4
    Forum Contributor
    Join Date
    11-05-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    229

    Re: Adding more conditions to this formula

    Hi!
    Could you upload a sample file? Then I could actually test my formula and find out whats wrong...

  5. #5
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Adding more conditions to this formula

    TRANSPORT.xlsmTRANSPORT SUMMARY.xlsx
    Sorry about the delay .

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: Adding more conditions to this formula

    You can't use INDIRECT with closed workbooks, so you will need to open the second workbook at the same time.

    Hope this helps.

    Pete

  7. #7
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Adding more conditions to this formula

    Hi Pete I am already aware of this its the second formula I am trying to get as you will see from the above examples I can get it to work for 1 condition but dont know how to get it to work for 2 conditions .

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: Adding more conditions to this formula

    Okay, try it this way:

    =SUMPRODUCT(COUNTIFS(INDIRECT("'"&$G$1:$G$3&"'!A:A"),"CAR",INDIRECT("'"&$G$1:$G$3&"'!B:B"),"Yes"))

    Hope this helps.

    Pete

  9. #9
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Adding more conditions to this formula

    It worked a treat thank you so much Pete I have been trying to get that formula as two weeks you have been very helpful

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: Adding more conditions to this formula

    Thanks for the feedback - your comments reminded me of the old joke:

    One man in a pub - "I've been trying to think of a word for two weeks"
    Other man - "How about 'fortnight' ?"

    Pete

+ 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