Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I am trying to do a COUNTIFS() function in which I need to compare the
difference between two numeric cells in the same row. In my spreadsheet, column G and column H contain year values (stored as integers). One of the criteria in my COUNTIFS() needs to check the difference between adjacent cells in these columns, for example, if H4-G4 = 5 or if H100-G100 = 10. I know the "easy" way would be to create a new column containing the differences, but I need to avoid that shortcut. Any ideas? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
It is unclear to me where the criteria comes in. Is it supposed to be Count
if the difference is 5 (or something like that)? -- Regards, PJ Please rate this post using the vote buttons if it was helpful. "David Aukerman" wrote: I am trying to do a COUNTIFS() function in which I need to compare the difference between two numeric cells in the same row. In my spreadsheet, column G and column H contain year values (stored as integers). One of the criteria in my COUNTIFS() needs to check the difference between adjacent cells in these columns, for example, if H4-G4 = 5 or if H100-G100 = 10. I know the "easy" way would be to create a new column containing the differences, but I need to avoid that shortcut. Any ideas? |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
PJ,
What I'd like to do is this: =COUNTIFS(H:H - G:G, 5) (There are other criteria I'm checking at the same time, which is why I'm using COUNTIFS().) The idea is that I want to check that the difference between columns H and G is 5. Does that help? --David "PJFry" wrote: It is unclear to me where the criteria comes in. Is it supposed to be Count if the difference is 5 (or something like that)? -- Regards, PJ |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
COUNTIFS can't do that. Try this:
=SUMPRODUCT(--(H1:H25-G1:G25=5)) -- Biff Microsoft Excel MVP "David Aukerman" wrote in message ... PJ, What I'd like to do is this: =COUNTIFS(H:H - G:G, 5) (There are other criteria I'm checking at the same time, which is why I'm using COUNTIFS().) The idea is that I want to check that the difference between columns H and G is 5. Does that help? --David "PJFry" wrote: It is unclear to me where the criteria comes in. Is it supposed to be Count if the difference is 5 (or something like that)? -- Regards, PJ |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Biff,
Thanks, that helps... I was afraid that COUNTIFS couldn't do that. So if I understand SUMPRODUCT correctly, in order to include the other criteria, I'll have to multiply in those other criteria, like this? =SUMPRODUCT(--(H3:H25-G3:G25=5)*(I3:I25="Excellent")) That seems to work for me. Is there a way to generalize this to include all rows from row 3 onward? (Rows 1 and 2 are labels.) --David "T. Valko" wrote: COUNTIFS can't do that. Try this: =SUMPRODUCT(--(H1:H25-G1:G25=5)) -- Biff Microsoft Excel MVP "David Aukerman" wrote in message ... PJ, What I'd like to do is this: =COUNTIFS(H:H - G:G, 5) (There are other criteria I'm checking at the same time, which is why I'm using COUNTIFS().) The idea is that I want to check that the difference between columns H and G is 5. Does that help? --David "PJFry" wrote: It is unclear to me where the criteria comes in. Is it supposed to be Count if the difference is 5 (or something like that)? -- Regards, PJ |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
=SUMPRODUCT(--(H3:H25-G3:G25=5)*(I3:I25="Excellent"))
Just keep the operators all the same. Try it like this: =SUMPRODUCT(--(H3:H25-G3:G25=5),--(I3:I25="Excellent")) Is there a way to generalize this to include all rows from row 3 onward? Excel 2007 has a lot of rows! The SUMPRODUCT function will calculate *every* cell referenced. So if you reference a lot of empty unused cells you're just wasting resources. =SUMPRODUCT(--(H3:H1048576-G3:G1048576=5),--(I3:I1048576="Excellent")) If you're only using a fraction of all 1,048,576 rows the above is a huge waste of precious resources! -- Biff Microsoft Excel MVP "David Aukerman" wrote in message ... Hi Biff, Thanks, that helps... I was afraid that COUNTIFS couldn't do that. So if I understand SUMPRODUCT correctly, in order to include the other criteria, I'll have to multiply in those other criteria, like this? =SUMPRODUCT(--(H3:H25-G3:G25=5)*(I3:I25="Excellent")) That seems to work for me. Is there a way to generalize this to include all rows from row 3 onward? (Rows 1 and 2 are labels.) --David "T. Valko" wrote: COUNTIFS can't do that. Try this: =SUMPRODUCT(--(H1:H25-G1:G25=5)) -- Biff Microsoft Excel MVP "David Aukerman" wrote in message ... PJ, What I'd like to do is this: =COUNTIFS(H:H - G:G, 5) (There are other criteria I'm checking at the same time, which is why I'm using COUNTIFS().) The idea is that I want to check that the difference between columns H and G is 5. Does that help? --David "PJFry" wrote: It is unclear to me where the criteria comes in. Is it supposed to be Count if the difference is 5 (or something like that)? -- Regards, PJ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 countifs function problem | Excel Discussion (Misc queries) | |||
Countifs to Sumproduct for 2003 - was Simple Countifs.. from Fr | Excel Worksheet Functions | |||
Alternative for =countifs (in 2007) for Excel 2003 | Excel Discussion (Misc queries) | |||
Need function that will work in Excel 2003 like "Countifs" in 2007 | Excel Worksheet Functions | |||
countifs - what is instead in excel 2000??? | Excel Worksheet Functions |