+ Reply to Thread
Results 1 to 4 of 4

Sum & If Statement

  1. #1
    Registered User
    Join Date
    03-21-2010
    Location
    London
    MS-Off Ver
    Excel 2008 Mac
    Posts
    2

    Sum & If Statement

    Hello,

    I have managed to get excel to look for a text string in a particular column on a different sheet using this formula:

    =SUM(IF(JUNE!B:B=+A6,1,0))

    The text string I am looking for is in the cell 'A6' - and for every occurrence of the string it finds, the result is incremented by 1.

    What I want to do now is get it to look in other columns in other sheets. I would be massively grateful if anyone can tell me how to add other columns to this formula!

    Cheers

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,645

    Re: Sum & If Statement

    How about =COUNTIF(JUNE!B:B,A6)

    and repeat for other sheets

  3. #3
    Registered User
    Join Date
    03-21-2010
    Location
    London
    MS-Off Ver
    Excel 2008 Mac
    Posts
    2

    Re: Sum & If Statement

    Hi Zbor, thanks for that.

    I'm pretty new to this so forgive me...

    I need to amend the formula I have so that excel will look in multiple columns for the text string - including the JUNE!B:B column that I already have in there. I just don't know how to add them into the formula if you see what I mean!

    =SUM(IF(JUNE!B:B=+A6,1,0))

    Thanks

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Sum & If Statement

    Hi mrsdoubtfire,

    if your columns are consecutive, you could use something like

    =SUM(IF(June!B:D=A6,1,0))

    You don't need the + sign before the A6 cell address, by the way. And, as your first formula, this is an array formula and needs to be confirmed with CTRL-SHIFT-ENTER.

    Or, much faster with Countif:

    =COUNTIF(June!$B:$D,A6)

    If your columns are not consecutive, you can use

    =COUNTIF(June!$B:$B,A6)+COUNTIF(June!$E:$E,A6)+COUNTIF(June!$L:$L,A6)

    The array formula equivalent of this would be

    =SUM(IF((June!B:B=A6)+(June!E:E=A6)+(June!L:L=A6),1,0))

    confirmed with CSE, but, to say it again: the Countif is much faster!!

+ 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