If cell contains a certain text, add the numbers of another cell [Solved/Closed]

mmbitar 2 Posts Saturday February 4, 2017Registration date February 5, 2017 Last seen - Feb 5, 2017 at 11:36 AM - Latest reply: Mazzaropi 1826 Posts Monday August 16, 2010Registration dateContributorStatus April 15, 2018 Last seen
- Feb 6, 2017 at 06:52 AM
Hello, I am trying to do my finances in an easier way, and would appreciate it if anyone can help me with the below question:

B2=Supermarket , C2=30$
B3=Fuel, C3=20$
B4=Fuel, C4=50$

if Bs="Fuel", i want to add the numbers in the adjacents cells together. but only if they contain the text in the B cells.
how can that be done without having to name each cell in case the list is long:
=IF(H6="Fuel", I6, 0)+IF(H7="Fuel", I7, 0)+IF(H8="Fuel", I8, 0)+IF(H9="Fuel", I9, 0)+IF(H10="Fuel", I10, 0)+IF(H11="Fuel", I11, 0) ...

Thank you all in advance!
See more 

1 reply

Mazzaropi 1826 Posts Monday August 16, 2010Registration dateContributorStatus April 15, 2018 Last seen - Feb 6, 2017 at 06:52 AM
0
Helpful
mmbitar, Good morning.

Try to use:

=SUMIF(H6:H20, "Fuel", I6:I20)

Adapt range references to your reality.

Is that what you want?
I hope it helps.
--
Belo Horizonte, Brasil.
Marcílio Lobão