#VALUE! error with if/countif/sum functions

EMcK01

Board Regular
Joined
Jun 14, 2015
Messages
125
Hi,

hopefully this is straightforward but I can't think of a way round it.

In cell E21 I have the following formula: =IF(COUNTIF($C21,"*")+(COUNTIF(D21,"*"))=2,IF(D21=$C$21,5,0),"")
essentially looking for a return value of either 5 or 0 as long as there is text in cells C21 and D21

my issue is this causes an error in cell E23 which has the following formula: =IF(SUM(E12:E15,E17:E19)=35,45,IF(SUM(E12:E15)=20,25+SUM(E17:E19),IF(SUM(E17:E19)=15,20+SUM(E12:E15),SUM(E12:E15,E17:E19))))+E21

If I change the formula in E21 to IF(D21=$C$21,5,0), the error clears however by removing the COUNTIF it allows a 5 value to be returned when it shouldn't.

Any help would be appreciated.

Thanks,
EMcK
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
=if(countif($c21,"*")+(countif(d21,"*"))=2,if(d21=$c$21,5,0),0)
 
Upvote 0
Maybe this?
=if(and(counta($C21:D21)=2,D21=$C$21),5,"")
However, you need to include E21 in the SUM formula, otherwise it will error trying to add "" so maybe something like this?
=sum(IF(SUM(E12:E15,E17:E19)=35,45,IF(SUM(E12:E15)=20,25+SUM(E17:E19),IF(SUM(E17:E19)=15,20+SUM(E12:E15),SUM(E12:E15,E17:E19 )))),E21)

Im pretty sure that last formula can be simplified, but try that for no
 
Upvote 0
Mart37, thanks for the response, that solved the issue I was having.

Ford, I should have mentioned that the formula in E21 could appear in G21 or L21 say, so the range that you used wouldn't work.

Thanks,
EMcK
 
Upvote 0

Forum statistics

Threads
1,215,353
Messages
6,124,462
Members
449,163
Latest member
kshealy

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