Return value based on earliest date value within set - excel

I'm looking for a formula to return the value from Column E, based on the earliest date in column B, within the Values in Column A in Sample table I attached.
I this instance, I seek to return 50% for Company A, 75% for Company B, and 50% for Company C.
Sample Table
Thanks in advance

Assuming sample data is located at A1:E7 (adjust formulas as required)
(Enter the FormulaArray pressing [Ctrl] + [Shift] + [Enter] simultaneously, you shall see { } around the formula if entered correctly)
To list Companies enter this FormulaArray in G2` and copy till last record
=IFERROR( INDEX( $A$1:$A$7, MATCH( 0, COUNTIF( $G$1:$G1, $A$1:$A$7 ), 0 ) * 1 ), "" )
To extract the earliest % Passed for each company enter this FormulaArray in H2 and copy till last record
=IF( EXACT( $G2, "" ), "",
INDEX( $E$1:$E$7,
MATCH( SMALL( IFERROR( $B$1:$B$7 * ( $A$1:$A$7 = $G2 ) * 1, 0 ),
1 + COUNTIF( $A$1:$A$7, "<>" & $G2 ) ),
$B$1:$B$7 * ( $A$1:$A$7 = $G2 ) * 1, 0 ) ) )

To get the percentage for when column A has a value of "A":
=MAX((MIN(IF(B2:B99*(A2:A99="a"),B2:B99))=B2:B99)*E2:E99)
This is an array formula and must be confirmed with Ctrl+Shift+Enter.
Note: if your data extend further down than row 99, then increase the 99s in the formula.
Note: you can edit the "a" in the center of the formula for "b" or "c". Better still would be a reference to a cell containing the value to calculate on. For example, let's say you enter A in cell G1, you could do this:
=MAX((MIN(IF(B2:B99*(A2:A99=G1),B2:B99))=B2:B99)*E2:E99)

Related

Percentage formula that skips over blank weekends

In an excel spreadsheet I have data that looks like:
Basically column A has the dates from the beginning of the year to the end of the year then Column B I manually enter values every Monday-Friday, Column C to get -2.3% I used the formula "=(C2727-C2726)/C2726" where 2727 and 2726 have the values 134,655 and 137,849 respectively. Then lastly column D has the days of the week.
The problem I have is that my current formula I have to enter every day because Monday and Tuesday get messed up because Saturday and Sunday are always blanks. So what I would like is a dynamic formula that does the same thing but for Monday it does "(Monday-Friday)/Monday" and Tuesday it does "=(Tuesday-Monday)/Monday"
Any help is appreciated
You could do in Column C:
= CHOOSE( MIN( 3, MOD( WEEKDAY( A5 ) - 1, 6 ) + 1),
"",
( B2-B5 ) / B2,
( B5-B4 ) / B5
)
and copy it down, where Column B contains your values and Column A contains your dates.
Note, however, that you will need to handle the first cell that ends up referencing your titles or start of data. Look at cell B4 in the above example: it errors out because it tries to calculate with B1 which contains a title. You may want to wrap this in an IFERROR:
= IFERROR( CHOOSE( MIN( 3, MOD( WEEKDAY( A4 ) - 1, 6 ) + 1),
"",
( B1-B4 ) / B1,
( B4-B3 ) / B4
),
"n/a" )

Excel: Lookup Multiple values with duplicates in multiple columns

I'm trying to link multiple lists and show all the values. Including duplicates.
My worksheet has data in 11 Columns. One column with Products(which can appear multiple times) and the rest with Store(which sell the products, no store sells the same product).
A small example here:
I've made a helper column(A) using the following formula : =B2&COUNTIF($B$2:B2,B2) . The helper column counts how many time a product show up in the Products Column(B). I thought it was needed.
I've managed to sort the data a bit using =VLOOKUP($C$2&ROWS($L$1:L1),$A$2:$C$11,2,0) like this :
Result
But I want to sort the data in a single Column for each store like this:
Desired Result
, without having to change the formula every 2-3 rows, as some store have 30 or so products. Is this something achievable with either formulas or VBA?
I would like to have the results in one column :
List Store 1 items as many times as they appear in Product column.
If an item(from Store 1) doesn't show up in Product column show "Product name -"
Product Column can have repeatable items
Each store has different products, so there's no conflict there.
If possible, since i have they Helper Column, if a product shows up 4 times, when i drag the formula in the 5th row it should jump to the next product.
Hope this is clear enough. Thank you
Later Edit: Maybe this helps a bit in understanding what I want to obtain.
Column 1 helper I've added it to count how many times a product shows up in Column 2. I want to get a separate column, which shows the items in Column 3(store1) x how many times they appear in Products Column. In the example above Store1 has product "Hansa" which appears 4 times in Product Column so it should appear 4 times in the separate column, after it there's product "Korek" which appears 1 time in Product Column so it should appear one time in the separate column under "Hansa" and so on. So basically I want to compare the third column to the second and show to values in the third x times they appear in the second in a different column.
This formula uses F1 as a helper cell, which is needed to count the matches in the product list.
Enter this FormulaArray in F1:
=SUM( IF( ISERROR( MATCH( $B$2:$B$11, $C$2:$C$6, 0 ) ), 0, 1 ) )
Enter this formula in E2:E11:
= IFERROR( INDEX( $C$2:$C$6,
AGGREGATE( 15, 6,
MATCH( $B$2:$B$11, $C$2:$C$6, 0 ),
ROWS( E$2:E2 ) ) ),
IFERROR( INDEX( $C$2:$C$6,
AGGREGATE( 15, 6,
ROW(E:E) / ISERROR( MATCH( $C$2:$C$6, $B$2:$B$11, 0 ) ),
ROWS( E$2:E2 ) - $F$1 ) ) & "-", "" ) )
Note that the helper column A is not needed.

Determine interval with known total and number of points

Doing some volunteer work for a non-profit, I recently had a problem that I couldn't easily figure out:
I had a dollar total of funds pledged for the year ($150,000), and I knew the total number of pledges (90), and I wanted to see what it would look like if the pledges were distributed evenly from zero to X until the amount had been reached with each increment being the same.
So, for instance if we had $15 raised among 5 pledgers, the even distribution would be 1,2,3,4,5. And I wanted to do it in all in excel, because small non-profit.
Using your provided data setup (Number of backers in cell A1, total pledged amount in cell A2), use this formula in cell C1 and copy down:
=ROW()*$A$2/((1+$A$1)*$A$1/2)
Note that this formula will give you different results than your original. However, it will provide correct results, just as yours does.
This is easy using Solver, we will put the 90 pledges in A1 through A90 and the increment in B1. Lets guess that the increment is 1 so we put that in B1.
in A1 we enter: 1In A2 we enter the formula:
=A1+$B$1
and copy down through A90In A91 we enter:
=SUM(A1:A90)
Clearly this is way off from the desired 150,000We can use Solver to adjust the value in B1 to get the desired result in A91:
The value Solver gets in B1 is 37.4307116107366We naturally would round this to two digits to get a good approximate solution
In a spreadsheet enter as A1 the number of "steps" in my case, pledgers as cell A1. In A2 enter the total you hope to reach. In my example $150,000. Finally in C1 enter the following formula:
= 2 *( ( (-1 * (2 * $A$1 * (ROW()) )) + ( 4 * (ROW()) * $A$2 ) + POWER( $A$1, 2 ) + $A$1 - ( 2 * $A$2 ))/( POWER( 2 * $A$1, 2 ) ) )
And then drag that column down the number of rows equal to your number of steps in A1. If you tally those values, it should equal the value in A2.
You'll notice that I use the ROW() function - if you'd like to start this on row other than row 1, you'll need to adjust the two calls to ROW to subtract the row you're on so that it equals 1 (and wrap it in parantheses) for instance here's the same function started on row 5 - note the "(ROW()-4)":
= 2 *( ( (-1 * (2 * $A$1 * (ROW()-4) )) + ( 4 * (ROW()-4) * $A$2 ) + POWER( $A$1, 2 ) + $A$1 - ( 2 * $A$2 ))/( POWER( 2 * $A$1, 2 ) ) )

Distribute Cell Value Over Column of Cells

I want to distribute a value over a column of cells in multiples of 0.25. For instance, if my value is 6 and my column consists of 10 cells, I want 6 of the cells to have a value of 0.5 and 4 of the cells to have a value of 0.75 to sum to 6.
Another example would be if the value was 1 and I wanted to distribute that over the same column of 10 cells. 4 of the cells should have a value of 0.25 and 6 should have a value of 0.
The unequal cells could either be the first 4 in the column or randomly selected from the 10.
This solution requires the following:
Range to enter variables located at B3:C6 (see fig. 1)
Number: Number to be distributed. Enter 6 in C3
Divider: Enter 0.25 in C4
Parts: Number of parts to distribute. Enter 10 in C5
Multiples: Formula to calculate & validate the parts to be allocated. Enter this formula in C6
=IF( MOD( $C$3 , $C$4 ) <> 0 , "!Err" , $C$3 / $C$4 )
Range to calculate the distribution located at E2:G13 (see fig. 1)
Parts: Keeps the relationship between distribution and part number. Enter this formula in E3 then copy till last record
=SUM( 1 , E2 )
Times: Number of times each part number contains the multiple. Enter this formula in F3 then copy till last record
=SUM( INT( $C$6 / $C$5 ) , IF( $E3 <= MOD( $C$6 , $C$5 ) , 1 , 0 ) )
Distribution: Resulting distribution. Enter this formula in G3 then copy till last record
= $C$4 * $F3
Total: validation of the distribution. Enter this formula in E3 then copy till last record
=IF( ROUND( SUM( $G$3:$G$12 , -$C$3 ) , 2 ) <> 0 , "!Err" , $C$3 )
Fig. 1
Fig. 2

How Can I Change Repeating date to one in excel?

I have below question:
On column A1: A16, I have some repeated dates.
On column B1:B16, I have the numbers which are assigned each one only to a date on column A. For instance, B1 to A1, B2 to A2 and etc.
I copy column A to column C and use from Data – Remove Duplicates.
Now, I want to have total sum of numbers which are assigned to each exact date on column D (front of column C).
I have attached an example of excel sheet.
How can I do?
4/4/2015 20000000 4/4/2015 94010000
4/4/2015 9510000 4/9/2015
4/4/2015 50000000 4/13/2015
4/4/2015 14500000 4/14/2015
4/9/2015 200000000 4/19/2015
4/9/2015 200000000 4/27/2015
4/13/2015 672716000
4/14/2015 28448000
4/19/2015 26168000
4/19/2015 26168000
4/19/2015 18568000
4/19/2015 18568000
4/27/2015 41368000
4/27/2015 13500000
4/27/2015 200000000
4/27/2015 52926000
Extract Unique Items and Corresponding Totals
Assuming that your data is located as follows:
Dates range B7:B21 and Amounts range C7:C21
To extract a list of unique dates enter this FormulaArray in E7 and copy till last record:
(Formulas Array are entered by pressing [Ctrl] + [Shift] + [Enter] simultaneously)
=IFERROR( INDEX( $B$7:$B$21, MATCH( 0, COUNTIF( $E$6:$E6, $B$7:$B$21 ), 0 ) * 1 ), "" )
Then to have the total amount for each date in the next column enter this formula in F7 and copy till last record:
=IF( EXACT( $E7, "" ), "", SUMIF( $B$7:$B$21, $E7, $C$7:$C$21 ))

Resources