How Can I Change Repeating date to one in excel? - excel-formula

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 ))

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" )

Need an excel formula that reads corresponding row

Lets say Cell I9 is 52
Cell A16 to A75 is a number ...example A16 = 1, A17=2, A18=3 and so on to 60
Cells B16 to B75 is a date for each number
F9 - I am trying to make a formula that would display the corresponding date that equals I9.
Can someone help me out with this?
Estimated Completion Days 4
Estimated Date of Completion
A B
Day Date
1 9/19/2017
2 9/20/2017
3 9/21/2017
4 9/22/2017
If the Estimated number of days = a certain value on the table, I would like for a formula I could put it another cell that displays the date for that number.
Assuming Estimated number of days is in Cell E16 and Estimated Date of Completion has to be displayed in Cell E17 then enter the following formula in Cell E17
=VLOOKUP(E16,A16:B75,2,FALSE)
or
=INDEX(B16:B75,MATCH(E16,A16:A75,0))
where A16:B75 is your data range.

Return value based on earliest date value within set

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)

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

Count If with multiple criteria and unique values

I have a sheet of data and want to run a count on the values in Raw data with the following criteria:
If the value in raw data is repeated FOR EXAMPLE London No1 and London No1 AUTO only to be counted once, but if the value in raw data is London No1, London No2 and London No1 Auto then only to count 2 (to count London No1 and London No2 only).
Raw data
London No1
London No2
London No1 Auto
London No2 Auto
Bristol No1 Auto
Cardiff No1
Cardiff No2
In this example Result should be: London - 2, Bristol - 1, Cardiff - 2.
This solution uses only one "working column" and assumes the following:
The list of Raw Data is located at A1:A16 (adjust as required)
The Raw Data records follow this syntax City NoX string all separated by a blank space. X is one digit number (do let me know if there will be larger numbers in order to adjust the formula)
(All ranges include header)
With the list of results located in the same worksheet at B1:D16
(adjust as required) and including the following fields:
Site: List of Cities to count in Raw Data
Unique Record: Used to list unique "clean" city records before counting. Enter this FormulaArray in D2 and copy till last record
(Formulas Array are entered by pressing [Ctrl] + [Shift] + [Enter]
simultaneously)
=IFERROR( INDEX(
MID( $A$2:$A$16, 1, 2 + FIND( "No", $A$2:$A$16 )),
MATCH( 0, COUNTIF( D$1:D1,
MID( $A$2:$A$16, 1, 2 + FIND( "No", $A$2:$A$16 ))), 0 ) * 1 ), "" )
Result Count: Enter this FormulaArray in C1 and copy till last record
=IF( EXACT( $B2, "" ), "",
IFERROR( COUNTIF( $D$2:$D$16, $B2&"*" ), "" ))
Assumptions
So if I understand your clarifications, you have a list of cities, and each city might have a different "No" on it. ie: some will be "No1", "No2", etc. Also, some might have "Auto" on it. There are sometimes duplicates, ie: "London No1" might appear twice. Also, whether or not the word "Auto" appears, it will be a duplicate if that "No" already appears. ie: "London No1" is identical to "London No1 Auto".
Helper Columns
To count how many unique instances of each city there are, I propose you use a helper column which first removes the word auto, and then only displays itself if it is not a duplicate of a prior entry.
With your data in column A, starting at A2, enter this formula in B2 and copy down:
=IF(ISERROR(MATCH(TRIM(SUBSTITUTE(A2,"Auto","")),$B$1:$B1,0)),TRIM(SUBSTITUTE(A2,"Auto","")),"")
This formula works as follows:
-First it takes the text in A2, and it replaces the word "Auto" with "". Then it TRIMS the resulting text, which means it earases any trailing spaces at the end. It takes that trimmed text, and attempts to MATCH it with the previous rows in column B. If it doesn't find a match, it results in an error. IF it ISERROR, then it shows the text (because it's the first time it has appeared). Otherwise, it shows "".
Array Formula
Now that you have this in column B, we will use Array Formulas to count how many unique instances of each city appeared. An Array Formula is a specific formula which calculates many time over an entire range, instead of just one cell. It then returns an Array of results, which we need to collapse into a single answer. For example:
=SUM(IF(A1:A5>5,B1:B5,""))
[Confirmed with CTRL + SHIFT + ENTER instead of just ENTER]
In the above example, the Array Formula will check if each individual cell from A1:A5 is a number larger than 5. If it is, it will return the cell from column B in that row. It then takes all resulting answers from column B (where A was > 5), and SUMS them to a single number.
In this case, the Array Formula will be as follows [Starting in D5 in your image and moved one column to the right, immediately to the right of the first city name, and copied down for each city; I am assuming that your raw data goes from A2:A100]:
=SUM(--NOT(ISERROR(SEARCH(C5,$B$2:$B$100))))
Confirm this formula with CTRL + SHIFT + ENTER instead of just ENTER. Then copy down for each city name in column C.
It works by attempting to search each unique value in column B for the city name shown in that row of column C. Wherever it the city name is not present, ISERROR returns TRUE for that element of column B. Then NOT turns all TRUEs to FALSEs and vice versa. Then the -- tells excel to convert TRUE and FALSE to their numerical equivalents [1 and 0, respectively]. So we will have a TRUE [AKA 1] for each match, and FALSE [AKA 0] for everything else. The sum of all 1's is the number of matches of that city name in your list of unique entries.

Resources