I need a formula to distribute values based on conditions.
In below (attached) image of excel sheet are two tables. Table-1 where i need data to be filled from Table-2. Formula should look in to table-2 and pick a value of 88587+HAWA+Jan and distribute in to Table-1 88587+HAWA+Jan column and so on till Dec...
Example:
In Table-2 formula pick 88587+HAWA+Jan (value is 71,405) than search in Table-1 for 88587+HAWA+Jan (in my case there are two matches to be filled with C3 and C6) now divide the value with count of matches 71,405/2= 35,703. Now formula put that 35,703 into C3 and C6.
Thanks in advance
Put this in C3 and copy over and down.
=SUMIFS(C$28:C$100000,$A$28:$A$100000,$A3,$B$28:$B$100000,$B3)/COUNTIFS($A$3:$A$24,$A3,$B$3:$B$24,$B3)
Related
Cell B2 has the value for demand, Cell C2 has the value for revenue, Cell D2 has the value for cost, and Cell E2 has the value for profit. In the worksheet, there is a table (or simply put, data) that generates the values for revenue, cost, and profit for any demand between the range 1 to 40. Thus, whenever I update the value in cell B2 to any integer between 1 and 40, the values in cells C2, D2, and E2 change accordingly.
What I want to do is, create a table with columns for demand, revenue, cost and profit. I manually entered the row data for demand, that consists of integers from 1 to 40. Now, I want to have data automatically entered into the rows of other 3 columns for all matching values of demand. For example, row 1 will have demand value 1, and the corresponding values for revenue, cost, and profit (as generated by cells C2, D2, and E2 when cell B2 is 1). Is there a function or VBA I can use to enter corresponding values automatically into all the rows (1-40)? Otherwise, I have to change B2 manually and enter the corresponding values for revenue, cost and profit all manually into the table, one by one. The reason why I need the table is to generate a line chart. Thus, if there is any other idea you've got, also appreciated.
For a simple solution that seems to work for you.
Use the current formulas you are using for the Revenue, Cost, and Profit within the table to calculate them. If you aren't familiar with Excel you can enter the formulas in the first row with respect to the Demand value and drag down from the bottom right hand corner of the cell to automatically copy the formula to the below cells.
Then for your B2, C2, D2, and E2 cells you could use VLookup to choose the correct values from the table based on the entry in cell B2.
If you linked an image of what you are trying to do I could give exact formulas but I believe this would work for your instance.
Sample Excel image
Please see attached sample image. I have identical but unique ID Numbers in cells A2:A10, and adjacent Values in cells B2:B10. THEN, there's another string of identical but unique ID Numbers in cells A11:A15 with adjacent Values in cells B11:B15. This grouping pattern continues far down the Sheet.
I would like a drag-down formula in column C to sum all the Values from column B based on the identical ID numbers from column A, and place that total in cell C2. The next sums would be placed in cells C11 and C16 based on my sample image.
Put SUMIF in an IF:
=IF(A2<>A1,SUMIF(A:A,A2,B:B),"")
Put that in C2 and copy down.
I have 2 cells A2 and A3, I will input a min value and max value respectively in each cell. Say 100 in A2 and 200 in A3.
I would like Excel to populate cells with values within that range. So Column B would have cells 1-101 filled in with 100,101,103,104,105....200.
Is there any easy way to do this or should I just stick to putting 100 in B1 and dragging it down?
In you first cell:
=IF(ROW(1:1)-1+$A$2<=$A$3,ROW(1:1)-1+$A$2,"")
Then drag/copy the cells down far enough to cover any combination you will have. You can fill the whole column if you want.
Microsoft is working on their Dynamic Arrays, Once released, a simple formula in the first cell of:
=SEQUENCE(A3-A2+1,,A2)
Will autmatically fill down the sequence without the need of dragging the formula down.
So at the top of my Excel sheet I have 2 cells, A2 and B2, where people can enter a starting and ending date.
On a seperate sheet I have an enormous list of starting and ending dates in columns A and B, and corresponding data for each of these 'events' in columns D through G. I need my function to copy all rows where the starting date falls between the two specified dates, and copy the data to the first sheet, in cells A4 - G4 through A100 - G100. (I just chose 100 as a large number, to make sure the area where the data gets placed is large enough)
I'm guessing this function I need includes the INDEX function, but I only know how to use it to look up one data cell at a time, not how to copy an entire range of cells.
Can anyone help?
No helper columns required.
Enter this formula into cell A4:
=IFERROR(INDEX(data!D$2:D$9999,SMALL(IF((data!$A$2:$A$9999>=$A$2)*(data!$A$2:$A$9999<=$B$2),ROW(data!$D$2:$D$9999),9E+99),ROW(1:1))-1),"")
This is an array formula and must be confirmed with Ctrl+Shift+Enter.
Now copy the formula to the range B4:D4.
Now copy the A4:D4 to the range A5:D100.
That's it.
Let's say Column C in the data sheet is blank, and free to add a formula.
Let's also assume that the data begins in row 2.
Then the following formula can be put in C2 & copied down:
=IF(AND(A2>=Sheet1!$A$2,B2<=Sheet1!$B$2),C1+1,C1)
Basically it is saying that if the beginning date of the current record is greater than or equal to the date the user is looking for, and the ending date is likewise within range, iterate the record, otherwise not.
At this point the user sheet can have a simple VlookUp as follows:
In D1: =VLOOKUP(ROW($A1),Sheet2!$C:$G,COLUMN(B$1),0)
Copy this across to G and down however many rows you like.
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(;).