+ Reply to Thread
Results 1 to 5 of 5

Problem with minusing 2 from an if formula

  1. #1
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Problem with minusing 2 from an if formula

    Hi everyone,

    I have the following formula:

    =COUNTIF('CORE Data Quarter'!$A:$A,'Trending Data'!A92&"*")

    What I want to do, is that if A92 = "RR001" then COUNTIF('CORE Data Quarter'!$A:$A,'Trending Data'!A92&"*")-2 should result, otherwise COUNTIF('CORE Data Quarter'!$A:$A,'Trending Data'!A92&"*") should calculate normally (without the -2). I have tried this:

    =IF('Trending Data'!A92="RR001",COUNTIF('CORE Data Quarter'!$A:$A,'Trending Data'!A92&"*"-2),COUNTIF('CORE Data Quarter'!$A:$A,'Trending Data'!A92&"*"))

    But i keep getting an 0 answer where as the answer should be 48. If i change 'Trending Data'!A92="RR001" to left(A10)="RR001" i get an answer of 50.

    Likewise, I have another formula on the same sheet:

    =SUMPRODUCT((LEFT('CORE Data Quarter'!A2:A3000,LEN('Trending Data'!A92))='Trending Data'!A92)*('CORE Data Quarter'!F2:F3000<80))

    Same thing with this one, if A92 = RR001 then the results should be SUMPRODUCT((LEFT('CORE Data Quarter'!A2:A3000,LEN('Trending Data'!A92))='Trending Data'!A92)*('CORE Data Quarter'!F2:F3000<80))-2, otherwise

    SUMPRODUCT((LEFT('CORE Data Quarter'!A2:A3000,LEN('Trending Data'!A92))='Trending Data'!A92)*('CORE Data Quarter'!F2:F3000<80))

    Any ideas, folks?

    Thanks!!
    Last edited by Groovicles; 01-21-2014 at 09:36 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Problem with minusing 2 from an if formula

    Hi

    Why not simply

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Problem with minusing 2 from an if formula

    Perhaps

    =IF('Trending Data'!A92="RR001",COUNTIF('CORE Data Quarter'!$A:$A,'Trending Data'!A92&"*")-2,COUNTIF('CORE Data Quarter'!$A:$A,'Trending Data'!A92&"*"))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Problem with minusing 2 from an if formula

    Maybe try:
    =COUNTIF('CORE Data Quarter'!$A:$A,'Trending Data'!A92&"*")-IF('Trending Data'!A92="RR001",2,0)

    I think it's a little shorter than righting out the countif twice.

    What happens if you type in a cell:
    'Trending Data'!A92="RR001"
    ?

    Does it return true? Often problems like this are to do with the data formatting, so uploading a workbook would be a good idea. Maybe you have an additional trailing/leading space in the A92 RR001? Have you tried:
    =COUNTIF('CORE Data Quarter'!$A:$A,'Trending Data'!A92&"*")-IF(trim('Trending Data'!A92)="RR001",2,0)

    Edit: Just saw Fotis' post, perhaps mine should be ignored...

  5. #5
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Problem with minusing 2 from an if formula

    Fotis and yudlugar, your formulas appear to working perfectly! Richard, thanks very much for your suggestion but the results came out to 50 again. Thanks very much guys!

+ 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. Replies: 2
    Last Post: 01-22-2013, 07:09 AM
  2. [SOLVED] Count C6:N6 minusing if a WS or HS are in those cells
    By summer2010 in forum Excel General
    Replies: 5
    Last Post: 04-25-2012, 06:14 AM
  3. Minusing a negative in an excel formula
    By JasonTurbo in forum Excel General
    Replies: 2
    Last Post: 09-14-2011, 05:41 PM
  4. adding and minusing at the same time
    By arada in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-16-2010, 06:02 AM
  5. minusing time
    By Crasher in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-08-2006, 03:58 PM

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