ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Referencing text from another cell for criteria in functions (https://www.excelbanter.com/excel-worksheet-functions/238017-referencing-text-another-cell-criteria-functions.html)

Tricia, not Patricia

Referencing text from another cell for criteria in functions
 
I know how to enter text as a criteria, but am looking for a way around
manually editing the text when doing multiple functions.

Example:
I give out different kinds of fruit to my students each day and enter the
amounts of each type into a spreadsheet daily. I want to add up how many of
each fruit were distributed.

Column A holds fruit names, column B holds quantities, and column D holds a
list of all the types of fruit. I would like to add totals for each type in
column E.

I could enter =SUMIF(A:A,"=fruitname",B:B) for each fruit in my list, but
I'd have to delete 'fruitname' and enter in each new fruit. How would I write
a function for "If any cells in column A equals the text in cell D2, add the
number of the corresponding cells in column B and enter the sum in cell E2."


Fred Smith[_4_]

Referencing text from another cell for criteria in functions
 
You do it this way:
=sumif(A:A,"="&D2,B:B)

Or, more simply:
=sumif(A:A,D2,B:B)

Even better would be to create a pivot table. Give it a try. You'll be
amazed how easy and powerful it is.

Regards,
Fred

"Tricia, not Patricia" <Tricia, not
wrote in message ...
I know how to enter text as a criteria, but am looking for a way around
manually editing the text when doing multiple functions.

Example:
I give out different kinds of fruit to my students each day and enter the
amounts of each type into a spreadsheet daily. I want to add up how many
of
each fruit were distributed.

Column A holds fruit names, column B holds quantities, and column D holds
a
list of all the types of fruit. I would like to add totals for each type
in
column E.

I could enter =SUMIF(A:A,"=fruitname",B:B) for each fruit in my list, but
I'd have to delete 'fruitname' and enter in each new fruit. How would I
write
a function for "If any cells in column A equals the text in cell D2, add
the
number of the corresponding cells in column B and enter the sum in cell
E2."




All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com