formaula calculate 2 cells

junkforhr

Board Regular
Joined
Dec 16, 2009
Messages
115
Office Version
  1. 365
Platform
  1. Windows
I have conditional statement {=SUM(IF('name of sheet'!$H$2:$H$226=H8,1,0))}

When ever I try to add a 2nd condition in using the wizard, I get incorrect results.

H8 is the cell that I want the calculation based on. How do I put on there that I want the calculation based on H8 or H9. If the answer is an easy one I apologise in advance. I'm a newbie to excel.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Something like this?

=SUM(IF(OR('name of sheet'!$H$2:$H$226=H8,'name of sheet'!$H$2:$H$226=H9),1,0))

Lee
Lee, I'm afraid you can't use an OR construct in this instance as OR doesn't return an array (it just returns either TRUE or FALSE) which is very annoying. AND works in a similar manner too.
 
Upvote 0
Thanks Richard, that works great, but I just realised, what if I want to add cells that are not adjacent , so instead of H8 and H9, I need to add H8 and Z30. I have no control over the data that is presented to me.

Cheers for your help so.
 
Upvote 0
Hi Richard
i see this formula using Or in array formula
Excel Workbook
A
15
23
36
45.5
Sheet1
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}. Note: Do not try and enter these manually yourself
and u said
Lee, I'm afraid you can't use an OR construct in this instance as OR doesn't return an array (it just returns either TRUE or FALSE) which is very annoying. AND works in a similar manner too.
how does it work ?
 
Upvote 0
Thanks Richard, that works great, but I just realised, what if I want to add cells that are not adjacent , so instead of H8 and H9, I need to add H8 and Z30. I have no control over the data that is presented to me.

Cheers for your help so.

You can do it like this, but using this formaul you need to know if your values in eg H8 and Z30 contain either Text or Numbers.
Excel Workbook
ABCDEF
110
22
333
4
514
62
73
80
91
102
113
12
13
14RichardSally
15BenJohn
16Terry
17Sally
18Richard3
19Ben
20Terry
21John
22Richard
23John
24Terry
Sheet1
Excel 2002
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
 
Upvote 0
Hi Richard
i see this formula using Or in array formula
Excel Workbook
A
15
23
36
45.5
Sheet1
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}. Note: Do not try and enter these manually yourself
and u said

how does it work ?

I'm sorry, but I don't see what relevance the formula you posted has to the statement I made?
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top