Text and Numbers in a cell

jomiscli

Board Regular
Joined
Feb 27, 2012
Messages
53
Office Version
  1. 365
Platform
  1. Windows
So I have been trying to use a SUMIFS formula to calculate stuff but I keep returning 0 no matter how much I try. My only thought now is that the numbers inside the cell with the text are not being considered numbers. Here is an example:

Wood:2, Stone:1, Metal:5

Does Excel automatically make each data type what it is? Or does it just automatically make is all text?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
So I have been trying to use a SUMIFS formula to calculate stuff but I keep returning 0 no matter how much I try. My only thought now is that the numbers inside the cell with the text are not being considered numbers. Here is an example:

Wood:2, Stone:1, Metal:5

Does Excel automatically make each data type what it is? Or does it just automatically make is all text?
If you start typing as text, it will continue as text. Each cell can only be one data type, not mixed.

With that being said, are all the numbers the last part of the string preceded by ":"?
 
Upvote 0
Excel will think anycell with text in it is text. You cannot just add those cells together.
But, what you can do:
1. Is use text tools (textbefore and textafter) to parse out the numbers. You may need to use a "Unary" operator to convert numerals that are text into numbers
Mr excel questions 67.xlsm
ABC
1
2Wood:28
3Stone:1
4Metal:5
5
jomiscli
Cell Formulas
RangeFormula
B2B2=SUM(--(TEXTAFTER(A2:A4,":")))


2. If you want to manipulate and convert the data to individual columns use the TEXT TO COLUMNS tool.
The TextToColumns is on the DATA tab.​
1697758513287.png
 
Upvote 0
I will definitely have to look at that Wizard.

Would something like this work:

IngredientsQuantity
Wood, Stone, Metal2, 1, 5


I was trying to limit the amount of rows/columns I needed because as my table grows the bottom starts to taper from increased ingredients and quantities.
 
Upvote 0
I will definitely have to look at that Wizard.

Would something like this work:

IngredientsQuantity
Wood, Stone, Metal2, 1, 5


I was trying to limit the amount of rows/columns I needed because as my table grows the bottom starts to taper from increased ingredients and quantities.
I don't think this works. Your just making a text string of numerals and commas.
But, you can use the text split function on that quantity string to again convert those to numbers....
Excel Formula:
=SUM(--TEXTSPLIT(B10,","))

Mr excel questions 67.xlsm
ABC
9
102,1,58
11
jomiscli
Cell Formulas
RangeFormula
C10C10= SUM(--TEXTSPLIT(B10,","))
 
Upvote 0
Thank you for your responses.

I just decided to have a column named 'Ingredients and Quantity' with sub columns that will have each ingredient and each quantity in their own cells. This way when you look at a row in the 'Item' column everything will be stored in its own cell with the appropriate data type.
 
Upvote 0
I was trying to limit the amount of rows/columns I needed because as my table grows the bottom starts to taper from increased ingredients and quantities.

The first rule in Excel is Get The Data Right. This applies when setting up a data range, performing an analysis, making a pivot table, charting data; anything in Excel.

The problem is that your approach makes analyzing the data incredibly difficult. I would think that your data would be easier to analyze if you had a column for each ingredient (i.e., columns for Wood, Stone, Metal, etc.) with quantities for each ingredient in the applicable column, or even better, one column for material, and another column for quantities, with multiple rows as needed for each item that uses a quantity of an ingredient.

Below I show what your approach seems like as well as my two alternatives.

AlternativeDataLayouts.png
 
Upvote 0
I am not sure where we are in this thread right now, but for your original post, if this is in cell A1...

Wood:2, Stone:1, Metal:5

then this formula will sum the numbers in that cell...

=SUM(IFERROR(0+TEXTSPLIT(A1,{":",","}),0))
 
Upvote 0
One takeaway should be that weird data structures require weird formulas to evaluate.

How can the original layouts in this thread be analyzed in a pivot table? How can you get the total by ingredient from a column of such cells?
 
Upvote 0

Forum statistics

Threads
1,215,105
Messages
6,123,114
Members
449,096
Latest member
provoking

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