Average cells within a range updates automatically, based on row values - excel

I have attached a sample file below. Can you help?
I'm looking for a formula to show the calculated average in cell B1 of the included sample, were the range (currently B2:B3) updates automatically when a new row is inserted at row 4 and the value 1.3 is shown in cell A4.
The range of the average formula in Cell B1, should update to show B2:B4... etc and continue to automatically update as new rows are added and additional numbers are added (1.4 in cell A5, average range updates to B2:B5, 1.5 in A6, average range updates to B2:B6 and so on...)
Thanks in advance for your help
Sample

Okay, finally I got what you mean. But your sheet looks not very efficient. Why not set A1 to 1, and A2 to =A1+0.1, and so on? For now A column has very long formulae which is hard to read.
Anyway... to use averageif() on 1.1, 2.1, etc, it'll be easier to make A column to text. So add another column(say C) and set C1 to =text(a1, "#") and drag down. Now that C1 is text, you can use averageif() with wildcard(*). set B1 like this:
=AVERAGEIF(C2:C99, C1&"*", B2:B99)
Of course, you should copy B1 and paste onto B4 and so on manually. Sample Excel file is here.

Related

Need help in excel formulas

I have formulas for the top 4 rows formula is as follows row 1) C1= A1+B1 row 2 ) C2=A2+B2 row 3) C3=A3+B3 row 4) C4=C3/C1 and the next row is blank ie C5 post which the same continues 4 rows has formula and the 5th row is blank I have a huge data how to copy the formula below please help
Am struck please someone assist
I have skipped the blanks and copied the first four rows selected the below rows and pasted I need any other alternative either by formula or by copy paste
Cell C1
= IFS(MOD(ROW(),5)=0, "", MOD(ROW(),5)=4, OFFSET(C1, -1, 0)/OFFSET(C1, -3, 0), TRUE, A1+B1)
You can calculate all your data using that formula simply. Just double-click or drag the fill handle of cell C1 down to copy the formula.
The easiest way to do this on a very large scale is to just have ONE and ONLY one formula that applies to all cells, so you are copying it all the way down the sheet one time.
I'd do this by looking at ROW() to get the row number, and more specifically, using MOD(ROW(),5) to get a row index that goes 0-4, with 0 being the blank row.
This formula will look back up to previous rows so you will have to "prime the pump" for the first 3 rows manually:
Cell C1 will be =A1+B1
Cell C2 will be =A2+B2
Cell C3 will be =A3+B3
Cell C4 will be =SWITCH(MOD(ROW(),5),1,A4+B4,2,A4+B4,3,A4+B4,4,C3/C1,0,"")
Then copy this cell, C4, down the entire length of the sheet.
My specific formula assumes there's no headers and the values start in row 1.
If not, you just have to move the formulas to the right SWITCH indexes 0-4.

How to create and copy a formula which takes data from every second column and adds it to another sheet in a row

I have a sheet ("Names") with data starting in B1 and continuing across the row with a named value in every second cell. (eg B1, D1, F1 etc).
I would like to use a formula to insert this in a second sheet ("List") as a series of rows. (Eg. B6, B7, B8 etc)
I have tried to add an OFFSET formula to the "List" sheet but can't copy this down the page.
I have tried:
=OFFSET('Names'!B$1,0,2)
However when I copy this formula down the column it continues to reference the same cell.
How do I get this to increment so I end up with a formula in each row of the "List" such as:
=OFFSET('Names'!B$1,0,2)
=OFFSET('Names'!B$1,0,4)
Which would return a list of names from the first sheet?
For example:
B1
D1
F1
etc
I would like it so if more rows are needed in the "List" to correlate to new columns in "Names", the formula can be copied down the row.
Any help is greatly appreciated
Since, i have shared the solution in comments, hence sharing it in answers as well, so that some one looking for a solution may find it useful in future,
• Formula used in cell B6
=OFFSET(Names!$B$1,0,(ROW(A6)*2)-12)

Is there a function in Excel which display the same cell value (e.g. client name) several times (as mentioned in another cell)?

Please refer to the picture. I would like to have one formula in the red marked cell (I4) which I can drag-down. I tried several formulas (like ADDRESS, INDIRECT or OFFSET) to kind of work with an array.
I tried the follwoing so far:
In cell I4 I made just the reference to the client name:
=Sheet1!A4
In cell I5 I started working on the formula:
=IF(Sheet1!D4-COUNTA($I$4:I4)>0;I4;ADDRESS(4+(Sheet1!D4-COUNTA($I$4:I4));1;1;FALSE;"Sheet1"))
Your help is much appreciated.
Can be easily achieved with a few helper columns, INDEX and MATCH formulas.
First helper, is a 'First Row' column, in column E (next to your Sum column). In cell E4 add =D4+N(E3) and drag this down for all your Client/Service rows
Then on Sheet2, add a 2nd helper column (Client Row) between your Row column and your Client columns. If Row 1 is in cell A4 on Sheet2, then put =IFERROR(MATCH(A4-1,Sheet1!$E$4:$E$6,1)+1,1) in cell B4, and then drag down.
For your Client column, in cell C4 put =INDEX(Sheet1!$A$4:$A$6,B4) and drag down.
Then when you change your values in your service columns the data on Sheet2 will update. I've assumed that if a client has zero services on Sheet1 you don't want them to appear on Sheet2, so for example if you make Client B 0 for service1 and service2 the your Sheet2 list will just show Client A and C, but with errors after the last client C row. Some error handling can be built into the formulas to deal with this if you want.
There should be other/easier ways to do it. But this is my approach.
Suggestion: Solve this kind of problems by breaking them in smaller steps.
Setup:
Formulas per column:
How many times (previous cell): =IFNA(VLOOKUP(H3;$A$4:$B$6;2;FALSE);0)
Count appearances in result (previous cell): =COUNTIF(H$3:H3;H3)+1
Find changes: =IF(E4-D4>0;1;0)
Sum changes: =SUM(F$3:F3)
Result: =IF(IF(F4=1;OFFSET($A$4;G4;0);H3)<>0;IF(F4=1;OFFSET($A$4;G4;0);H3);"")
Drag the formulas down
In Sheet2 I4, formula copied down :
=LOOKUP(ROW(Sheet1!A1),SUBTOTAL(9,OFFSET(Sheet1!$D$3,,,ROW(Sheet1!$A$1:$A$4)))+1,Sheet1!A$4:A$6)&""

Excel Drag to increment sheet name between file

how to drag to increment the excel sheet from different file?
eg,
Cell A1 =+'[filename]59'!J6
Cell B1 =+'[filename]60'!J6
Cell C1 =+'[filename]61'!J6
i tried this now
=INDIRECT("SHEET"&COLUMN()-1&"!J6")
and readjust all the name etc, and now i wanna drag down and increment the cell to J7,J8,J9 etc
how do i do it?
Help please
Try =INDIRECT("SHEET"&COLUMN()-1&"!J"&ROW()). ROW() returns your current row. So, if you write =ROW() in A15, you'll get 15. Good for dragging down :)
If you want to change the value so that it matches a row different from your current row, you'll need to add or subtract from ROW(). So, if you wanted to put this in some cell B2 or C2 and have it match up to J5, you'd have to add 3. That would work like this:
=INDIRECT("SHEET"&COLUMN()-1&"!J"&(ROW()+3))
Obviously, you should change the 3 to whatever adjustment value you need.

Convert Excel Columns into Rows

Please take a look at the attached snapshot.
How to convert the Original Table to the Required Table, in the easiest manner ?
Here, I have shared just a small sample, the real table is quite big having more then 100 rows / symbols and 100 columns / dates.
Therefor it is not possible to manually copy paste the data to change the table format.
The final output table will have just 3 columns "symbol, date and value" arranged according to the dates in ascending order.
Please suggest how to do this. Thanks
here it is.
Put Original table in one sheet, say Sheet1. Top left cell being A1 = Symbol
Go to another sheet, say Sheet2.
In cell A1 put: Symbol
In cell B1 put: Date
in cell C1 put: Value
Go to cell A2 and put this formula:
=INDIRECT("Sheet1!A" & 2+MOD(ROW()-2; X);TRUE)
Go to cell B2 and put this formula:
=INDIRECT("Sheet1!R1C" & 2+ROUNDDOWN((ROW()-2)/X;0);FALSE)
Go to cell C2 and put this formula:
=INDIRECT("Sheet1!R" &2+MOD(ROW()-2; X)&"C" & 2+ROUNDDOWN((ROW()-2)/X;0);FALSE)
In all formulas above, replace X with the number of Symbols you got. In your original table there are 4.
Now fill down as needed
Note: If functions don't work, use comma(,) instead of semicolon(;).

Resources