Average only the numbers part of cells - excel

I am trying to average some cells, but they contain both numbers and characters. Obviously excel reads these as text so doesn't give an average of the numbers.
What can I use to make the formula only look at the numbers part of the cell? I tried a combination of sum and left but this hasn't worked. Do I need an array formula perhaps (something involving ={sum(left(A1:C1))});
For example
Cell A1 B1 C1
Grade 6a 8b 4c
the answer should be (6+8+4)/3=6

If there is always one and only one letter after the number you could create a second row that strips it off as follows:
Cell A2: =1*Mid(A1,1,Len(A1)-1)
Important to have the 1* part of this formula as then it creates a number. Then you can average this row.
Alternatively you could use the array formula:
=AVERAGE(1*MID(A1:C1,1,LEN(A1:C1)-1))
remember to hit CTRL+SHIFT ENTER when you are done editing the cell. Excel will put {} around the function in the editing window to show it's an array formula.

Related

Insert a formula from another sheet based on same cell values

I have a master workbook with two columns: names and formulas, which are specific for certain names. Generally, there are some 300 different names and 10 different formulas. What I need is to insert that formula in another sheet when some of this names appear - some kind of vlookup formula which won't give me value but formula.
And second part of a problem is how to make this formula (if it can be somehow inserted) dynamic and use relative values for calculation from same row in calculation sheet....
Please see my simulation below. My formula is F3 (ignored = sign) and its name is Name1. For test purpose, I typed 7 into cell F3 and 8 into cell F4.
With the formula below I typed in sheet2, I am able to call the formula of =F3 and change the reference given to cell F3 to F4 and reach to result of 8 in master sheet.
=INDIRECT("Master!"&SUBSTITUTE(VLOOKUP("Name1",Master!$I$3:$J$10,2,FALSE),"3","4"))
Maybe you can solve your puzzle by using functions I used in above simulation (INDIRECT and SUBSTITUTE).

Excel - Writing proper SUM formula

I am supposed to sum up the total highlighted numbers and add the sum in the red marked cell beside the average number. I am using a basic SUM formula to add the cells. I have a couple thousand lines to do this with and I have to manually change the SUM formula to include the right ranges (as some have 4 numbers to add up, some have 3 and others have 2). Is there a way to write the formula so it SUMS all the numbers up until the Average line above it? So I can use the same formula throughout my sheet and not have to change it for every line?
No need for Array formulas.
I will assume you are starting in H2. As per your photo in the discussion
=IF(E2 = "Average",SUMIF($E$1:E1,"<>Average",$G$1:G1)-SUM($H$1:H1),"")
And copy down.
You could use a variable range within a SUM function, using INDEX and MATCH to find the previous instance of Average.
Something like this - an array formula, so enter with Ctrl+Shift+Enter:
=SUM(B3:INDEX(B$1:B3,IFERROR(MATCH(2,1/(A$1:A3="Average")),0)+1))

LibreOffice highlight cells if they are the same as a specific range

Master and Step Chart
Hello, I'm using A4-E4 as a "Master" code, and incrementally using A5-A8 to replace A4, B5-B8 to replace B4, etc etc first replacing one number of the "master", then two different numbers, etc until I have basically every combination. At some point the same number as the "master" is going to be generated. I have the numbers separated into groups of 16 on individually sheets for a total of 64 sheets. Obviously at some point the same number "43254" is going to generate on one of the sheets. Is there a way to search/highlight that number automatically upon generation? I've found that I can do conditional formatting to search for a specific cell, but not a range of cells. Like compare "A4-E4" to every set of five adjacent numbers in all the sheets, then highlight it. I have no idea if this is possible, but I'd appreciate it.
Select cells A4 through E4 and go to Format -> Conditional Formatting -> Manage. Apply style Good if Formula is:
CONCATENATE($A4;$B4;$C4;$D4;$E4)="43254"
So 43254 matches.
And 43253 does not match.
This is more complex than first appears. The following explanation may be difficult to understand if you do not have much experience with conditional formatting.
The formula gets evaluated 5 times, once for each of the cells.
Normally, rather than always indicating cell A4, Calc would interpret A4 as the currently evaluated cell (because we selected cells starting from A4). And B4 would indicate the cell to the right of the current cell that is evaulated. So for example, if such a conditional formatting formula were filled to cell D7, then A4 would actually indicate cell D7, and B4 would indicate cell E7.
However, our formula uses $A4 instead. The $ tells Calc that we always want column A even if the formatting is for column B or C et cetera.
One outcome of this is that the formula can be filled down or up but not left or right. If it is filled down one row for example, $A4 refers to column A but the current row, which would be cell A5.

Copy formula down column, but skipping a row here and there

So I have a formula that pulls data from another sheet and sums it. I want to pull this formula down the column, but I need to skip every eighth row. I need the formula to only increment by one as it jumps this row. Is there a quick way to accomplish this?
EDIT: To clarify, if cell A7 has formula =SUM(C3,H3) then I need A8 to be empty and A9 to be =SUM(C4,H4)
You could use - IF(MOD(ROW(),8) to identify the 8th row and do a different action i.e make it blank. Without seeing the formula its hard to know how this would effect your increments
If you are needing to have a moving sum to account for the empty spaces - this (or something along these lines) should work:
=IF(MOD(ROW(),8)=0,"",SUM(INDIRECT("B"&ROW()-ROUNDDOWN(ROW()/8,0)),INDIRECT("G"&ROW()-ROUNDDOWN(ROW()/8,0))))

Excel 2010: Counting cells with adjacent cell blank

I have data in rows where each column represents a day, some of which are blank and some of which have numbers. I want to "scan" down the row, comparing each cell with the one before to the left of it (or the one 2 spaces left of it, etc). For example, I want to sum the number of cells (days) with a blank in the cell before it. Or, I want to sum the number of cells that are greater than the cell to the left of it. I can't figure out how to dynamically compare to the prior column using addresses that change with each cell.
This is from what I understood from your Question:
If you refer to the screenshot below, you want to count Columns B to H if the column has a number and the column to the left is blank.
So, if this was just one column, we would write the formula as:
=COUNTIFS(B3,">0",A3,"")
Now since you want to do this for a range of columns (an array of cells), you need to do something like:
=COUNTIFS(B3:H3,">0",A3:G3,"")
and accept with a Ctrl + Shift + Enter.
So the formula would be displayed as:
{=COUNTIFS(B3:H3,">0",A3:G3,"")}
Array formulas are perfect for this task. I can't give you a lecture on the topic but you should read on it. Basically, you can select multiple cells in a range and act as if it was one cell.
For example, you could do something like this:
=SUM(IF($A$1:$A$100="", 1, 0))
When you enter array formulas, be sure to hit CTRL + SHIFT + ENTER in the formula box to signify that you want Excel to treat this formula as an array formula. Otherwise you will not get the expected results.
Using this method you can do any kind of comparison. Sometimes it helps to see how Excel treats the formula. You can select part of the formula in the formula editor and hit F9 to see what this segment computes to according to Excel.

Resources