Dividing in excel by looking up another value - excel

Looking to create a formula in excel that will divide a cell value by the last time a certain value had a once next to it:
A B C
20/04/2015 1.68 0
17/04/2015 1.68 0
16/04/2015 1.72 1
15/04/2015 1.66 0
So ideally it would be something that took 1.68 and divided it by 1.72, and it found 1.72 because of the 1 adjacent to it in column C.

You can use this formula in cell C2 then drag it to the bottom. =IF(C3=1,B2/B3,"")

To find the last value in column B that has a 1 next to it, you can use this formula:
=LOOKUP(2,1/(C:C=1),B:B)
So for the division, you could do something like:
=B1/LOOKUP(2,1/(C:C=1),B:B)

Related

Check if there is at least one value in column C that is bigger then the value in Column B (without Helper Column)

A
B
C
D
1
Product
sales_volume
purchase_volume
Check
2
Product_A
500
400
yes
3
Product_B
600
700
4
Product_C
300
250
5
Product_D
800
620
6
Product_E
100
100
7
In Cell D2 I want to have a formula that is doing the following:
= If there is at least one value in Column C > value in Column B then "yes" else "no"
I know I could achieve this with a Helper Column that subtracts the values from both Columns and then check the Helper Column for values >= 0.
However, I would prefer a solution without a Helper Column.
Do you have any idea if this is possible?
=IF(SUM(IF(C2:C6>B2:B6, 1, 0))>0, "yes", "no")
Be warned this is an array formula so might required you to press Ctrl+Shift+Enter after typing the formula instead of just inserting it normally
If B2 is GREATER than the largest number in the range C2:C6, then "no", else "yes".
Try this formula in cell D2:
=IF(B2>MAX(C$2:C$6),"no","yes")
you can then drag the formula down to other cells

Formula to calculate a sum of differences and count them

I have the following Excel spreadsheet:
A B C D E F G H
1 Sales 500 700 600 450 550 600 500
2 Helper Row (Differences) 40% -14% -25% 22% 9% -17%
3 Helper Row (Counts) 0 0 1 0 0 0
4 Count Result 1
In Row 1 you can see the sales over different periods. In Row 2 the difference between the sales are displayed. (e.g. formula in C2=C1/B1-1).
In Row 3 the formula indicates 2-Following-Periods in which in total the sales drop by >-20%.
In the case above this applies to cell E3 because the sales in cell D2 drop by -14% and in the next period in cell E2 by -25% which makes a total drop of those two periods by -39%.
The formula I use in Row 3 is for example E3=IF(SUM(D2:E2)<-0.2,1,0).
Eventually, I use a sum function in cell B4 (B4=SUM(B3:H3)) to count how often the above described criteria is met.
All this works perfectly so far. However, my target now is to get rid of the Hepler Row 2 and Row 3.
Do you know a formula that gives me the count result which meets the above described criteria?
Assuming that your above demonstrated numbers are in cell B1:H1, you can use following formulae to achieve result without helper cells.
Array formula (CTRL+SHIFT+ENTER and not just ENTER)
=SUM((((C1:H1-B1:G1)/B1:G1)<-0.2)+0)
Or for normal ENTER
=SUMPRODUCT((((C1:H1-B1:G1)/B1:G1)<-0.2)+0)

Select next higher number in array based on a minimum criteria

I have the following Excel spreadsheet:
A B C D
1 0 0.99 Minimum: 6
2 1 0.99 Input: 3
3 2 2.99 Result: 4.99
4 3 2.99
5 4 4.99
6 5 4.99
7 6 7.99
8 7 7.99
9 8 9.99
10 9 9.99
The formula in cell D3 is:
=LARGE(B$1:B$10,COUNTIF(B$1:B$10,">"&D2))
This formula selects the next highest number in the array in
Column B based on the input in cell D3.
For example:
If the input in cell D3 is 3 it will select
4.99 instead of 2.99.
All this works perfectly with the formula in cell D3.
However, now I want to insert a minimum criteria into this system
in cell D1.
For example: If the minimum is 6 the formula in cell D3 should notice it
and select 7.99 instead of 4.99.
Do you have any idea how to solve this issue?
Is there a way to do it without using an array formula?
You can use COUNTIFS to include multiple criteria, instead of your COUNTIF.
So in Cell D3 put the formula below:
=LARGE(B$1:B$10,COUNTIFS(B$1:B$10,">"&D2,B$1:B$10,">"&D1))
It means that the formula is searching for 2 criterias:
Cells Value is larger than value in Cell D2 (Input).
Cells Value is larger than value in Cell D1 (Minimum).
Using INDEX/MATCH you could restrict the range that's looked at, although I feel there's a better way:
=LARGE(INDEX($B:$B,MATCH($D$1,$A:$A,0)):INDEX($B:$B,COUNTA($A:$A)),COUNTIF(INDEX($B:$B,MATCH($D$1,$A:$A,0)):INDEX($B:$B,COUNTA($A:$A)),">"&$D$2))
You could place the INDEX/MATCH into a named range to make the formula shorter.

Find value in 2D array and return value in adjacent cell

**Sheet 1**
ColumnA B C D E F G H
------------------------------------------------------------
EURUSD 1.2765 1 ACCOUNT624 2 account125 1 account834
EURCAD 1.01 2 Account49 3 account45 2 account67
EURGBP 0.78 2 Account777 1 account45 2 account678
**Sheet 2**
ColumnA B C D
---------------------------------------
EURUSD 1.2765 Account 624 ?
EURUSD 1.2765 Account 125
EURUSD 1.2765 Account 834
EURCAD 1.01 Account49
EURCAD 1.01 Account45
In Sheet 1 above each row shows a currency trade and what quantity goes to each account.In Sheet 2 each row shows 1 account only. I would like to populate columnd D in sheet 2 with the quantites from sheet 1.
Breaking it up into steps, i would like to:
Find the price in Sheet2!B1 in sheet1
On the same row in sheet1, find the cell containing the same account as Sheet2!C1
Return value in cell to the left of cell with matching account
I have used index/match before but I can't get it to work for 2 dimensional arrays. Can anyone help with a formula? Thanks in advance!
It's not pretty, but using what you requested - to find the match based upon price in column B (I would say your safer bet would be to use the Currency conversion "EURUSD", for example, since what if 2 currencies have the same ocnversion rate??), paste this formula in cell D1 on your second sheet:
=OFFSET(Sheet1!$B$1,MATCH(B1,Sheet1!$B$1:$B$3,0)-1,MATCH(C1,OFFSET(Sheet1!$B$1,MATCH(B1,Sheet1!$B$1:$B$3,0)-1,0,1,10),0))
You can then drag it down / change ranges as needed.
(PS - I'm also assuming you made a mistake on sheet2 and that the account numbers will be typed the exact same in both sheets)

Macro to split weight into columns Request

Let's say I have a column of numbers in A2 going down, to a random number, such as:
0.50
1.00
1.00
1.10
1.10
And I wanted a macro to split them into Major and Minor basically.. Anything before the Period, I want moved over to Column B. Anything after the Period I would like moved to Column C, and the . Just removed completely.
So
B C
0 50
1 00
1 00
1 10
1 10
Like that, Pretty simple. I don't know enough about Excel VBA to write it.
Just record the following macro:
Copy column A to B
Format column B as text
Data->TextToColumn on Column B with separator "."
I would just use formulas instead of VBA. Put this in B2:
=INT(A2)
and this in C2:
=(A2-B2)*100
Then copy and paste down.

Resources