Any suggestions for making this simpler?

MillieDeighton

New Member
Joined
Jul 17, 2011
Messages
2
i am trying to add together a number of nested if functions. the current formula that i have inputed is as follows:

=IF(C2="A",50,IF(C2="B",25,IF(C2="C",0)))+IF(C3="A",50,IF(C3="B",25,IF(C3="C",0)))+IF(C4="A",50,IF(C4="B",25,IF(C4="C",0)))+IF(C5="A",50,IF(C5="B",25,IF(C5="C",0)))+IF(C6="A",50,IF(C6="B",25,IF(C6="C",0)))

i tried using a sum function to simplify the above equation:

=SUM(C2:C6, IF(C2:C6="A",50,IF(C2:C6="B",25,IF(C2:C6="C",0))))

but it returned<TABLE style="WIDTH: 48pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=64 border=0><COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY><TR style="HEIGHT: 15pt" height=20><TD class=xl65 style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; WIDTH: 48pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 15pt; BACKGROUND-COLOR: white" width=64 height=20>#VALUE!</TD></TR></TBODY></TABLE>

ecxels reason for this is because cells C2 to C6 contain letters.

is there anyway that i can add the if functions for the different cells without having to use the ultra long equation at the top?

thanks to anyone who can help
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I think this formula will do what you want...

=50*COUNTIF(C:C,"A")+25*COUNTIF(C:C,"B")

Note that we do not need to include a term for cells containing "C" because its evaluated value of 0 will add nothing to the total.
 
Upvote 0
brilliant thank you. have just tried it and it works perfectly.

thank you so much you have saved me much time trawling through the internet and excel help haha.

thank you again.
 
Upvote 0
i am trying to add together a number of nested if functions. the current formula that i have inputed is as follows:

=IF(C2="A",50,IF(C2="B",25,IF(C2="C",0)))+IF(C3="A",50,IF(C3="B",25,IF(C3="C",0)))+IF(C4="A",50,IF(C4="B",25,IF(C4="C",0)))+IF(C5="A",50,IF(C5="B",25,IF(C5="C",0)))+IF(C6="A",50,IF(C6="B",25,IF(C6="C",0)))

i tried using a sum function to simplify the above equation:

=SUM(C2:C6, IF(C2:C6="A",50,IF(C2:C6="B",25,IF(C2:C6="C",0))))

but it returned<TABLE style="WIDTH: 48pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=64 border=0><COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY><TR style="HEIGHT: 15pt" height=20><TD class=xl65 style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; WIDTH: 48pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 15pt; BACKGROUND-COLOR: white" width=64 height=20>#VALUE!</TD></TR></TBODY></TABLE>

ecxels reason for this is because cells C2 to C6 contain letters.

is there anyway that i can add the if functions for the different cells without having to use the ultra long equation at the top?

thanks to anyone who can help
Here's another one...

Book1
C
2C
3B
4B
5A
6B
Sheet1

=SUM(COUNTIF(C2:C6,{"A","B"})*{50,25})
 
Upvote 0

Forum statistics

Threads
1,224,589
Messages
6,179,744
Members
452,940
Latest member
rootytrip

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