Taking column value for the if condition in excel - excel

I'm creating target revision tool to change the old target to new target based on sales percentage. It's difficult to keep all the sale percentage in If formula as conditions. So I added the between value condition (Ex:-1.99%, -1.00%) in Column G and H.
Now the problem is If column C value (Ex: -1.00%) is in between any of the % range in Column G and H, then the target value in Column B (Ex:10) should be Increased/Decreased based on the value in Column I straight to the range in Column G and H (Ex:-1.90%, -1.00% = 10) and calculated as 20 in Column D (revised target).
I'm attaching the screen shot of the excel.
So far the formula I used is this,
=IF(AND(G5>=S5:S18,G5<=T5:T18),B5+($U$5:$U$18,U5),B5)

It looks like the values to add/subtract are following a pattern and to arrive at the value you just need to multiply the rounded percentage by -5.
But if that is not suitable, or if you want to change the amounts not to follow a pattern, you can use the table in columns G to H as a lookup table.
In cell D2 use the formula
=B2+VLOOKUP(C2,$G$2:$I$15,3,TRUE)
Make sure to format column D as General

Related

How can I select a specific cell value filtering with the nearest date (in a column) to select a specific row?

I am very new in Excel and I have to implement this pretty complex task (at least for me it is complex).
I put what I am doing here: https://drive.google.com/open?id=1sWHbyl-Y-GgSiX7JJ3bJ9_y8DUts-E0e
I will try to explain exactly what I have to do:
For each rows I have to "calculate" the value of the L column in this way.
Each cell into the L column is "calculated" using the following steps:
Considers the date into the H column of this row.
Search the nearest date in the past into the A column to select a specific row.
Take the E column value of this row and use it to populate the current L cell.
So doing a practical example, I want to populate the L3 cell, I have to do:
Considers the date into the H column of this row: so I obtain the value of the H3 row that is this date: 16/12/2017.
Then, into the whole A column I search the nearest date in the past in this column (in this case it is 15/12/2017), so I select the row number 4.
Take the value of E4 cell value (598,05 €) and write it into my L3 cell.
How can I do something like this?
Thank you
This is a simple INDEX(...,MATCH()) situation.
=INDEX(E:E,MATCH(H3,A:A,1))
This will return the value in column E such that the date in column A is the greatest date less than or equal to the value in H3.
Note: This assumes the dates in column A are sorted in ascending order.
VLOOKUP:
=VLOOKUP(H3,A:E,5,TRUE)
This requires the dates in Column A to be sorted.

CountIf not counting values derived from formula

I couldn't find a matching answer already but happy to be redirected!
My issue is with countifs across two worksheets but I can replicate it in a smaller environment.
I have three columns of data (A-C): -
Column D has the formula =IF(A2="Closed",C2-B2,0).
That bit works, I now need to count how many took X number of days to close: -
Column G has the formula =COUNTIFS(A2:A11,"Closed",D2:D11,F2)
Looking at the pictures 41 and 49 should have a count of 1 right? What have I done wrong? All cells are formated as numbers.
Your formula in column G uses an absolute comparison to the value in column F.
The problem is that none of your values exactly match that value.
The duration column is formatted to show a value rounded to a day, but the underlying value is not the same as what is showing in the formatted cell.
Therefore, the formula in column G needs to factor in a range of values like this:
=COUNTIFS($A$2:$A$11,"Closed",$D$2:$D$11,">="&F2,$D$2:$D$11,"<"&F3)
In words: count all the cells where column A shows "Closed" and where the value in column D is between the value in F2 and the value in F3.
You will need to add an extra value in column F for anything above your biggest number in column F.
Check you output in Column D. It must be having decimals. If that is the case, you need to round the formulas in column D using ROUND formula.
=ROUND(IF(A2="Closed",C2-B2,0),0)
Rows 4 and 7 have status as "Open" and hence won't be counted by Countifs, i. e. change value of cells A4 and A7 to "Closed" to see updated results.
Also, fix your range $A$2:$A$11, etc. when using Countifs

Calculate Average Time from Column B based on Values in Column A

I'm new to Excel. I'm looking for formula to perform the following.
Column B has values like TM, LA, Break etc. And Average Handling Time (AHT) will be captured in Column E. Now I need Average AHT for the values in Column B. Ex: If Column B has 6 "TM", then their respective time in Column E should be Averaged. This Avg value will be in Cell G4. Similarly I need Avg AHT time for other values in Column B. Can someone help me in this..
Please Refer to the attached Image above
AVERAGEIF
Use the AVERAGEIF function.
Place the following formula in G4 and copy to the right:
=AVERAGEIF($B$4:$B$15,RIGHT(G$3,2),$E$4:$E$15)
Format G4 and H4 to the desired time format or you will see a decimal number.
Proof of Concept
Explanation:
The AVERAGEIF function has three arguments
=AVERAGEIF(A, B, C)
A: Range of cells that has you criteria in it
B: What your criteria is
C: Range of cells to take the corresponding average of
In this case A is $B$4:$B$15. The cell addresses have been lock with the $ to prevent them from changing when the formula is copied.
For B we used the RIGHT(G$3,2) formula. This pulled the last two characters from your header above. Only rows in B that match the last two characters of the headers will be used for the average calculation. Alternatively, this could have been hard coded as "TM" or "LA"
For C, the times in the range $E$4:$E$15 were supplied. The values that match were added together and then that sum was divided by the number of matches to get the average.

excel reference the first column of table

Dog Cat Bird Gary
A 0 C 100%
B 0 B
C ok D 100%
D ok 100%
E no A
F ok F 100%
Is it possible to reference the 1st 2nd or 3rd column by column number/position instead of column header? So instead of
Table1[#Dog]
It would look more like this.
Table1[#(1st column)]
In VBA it is.
ListObjects("Table1").ListColumns(1)
But I need to know if there is a formula way to do this?
Also Just to make clear I DO NOT want to know what column number or letter it is in the worksheet. I want to reference the 1st column by position within the table, NOT header name. TY
If you want to refer to cells in the same row as your formula, which is what it looks like from your question, you can use INDEX.
Above, the formula =INDEX(Table2[#],2) refers to the second column in the same row as your formula.
If you don't want to refer to the row the formula is in, just refer to the whole table and INDEX on the row and column. For example, this refers to the fourth row in the second column:
=INDEX(Table2,4,2)
Note that Table2 refers to the data area of the table - not the headers - just like a database table.
Offset formula.
If Dog is in A1 and you want BIRD in C1 then you would use this formula
=Offset(A1,0,2,1,1)
=Offset(Refecence Cell, X, Y, B, D)
Offset starts a range, down X rows and over Y columns from the reference cell (first tow numbers) and returns a range the size of the second two numbers of B rows and D columns.
Here is a link to a description of the OFFSET function

Vlookup help in Excel

What I am trying to do is compare column B with column F (Being an invoice number) and column D with column J (Being a money value) and if the value exists in all columns then maybe say YES in column M?
There will be occasions where both Column B and F do match but column D and J don’t so I would like them to highlight in red or something too.
If I understand you question correctly, you can do what you need with Conditional formatting.
I sampled some data starting in row 3.
Per your instructions I have Invoice numbers in columns B and F.
I have the corresponding dollar values in columns D and J (D being related to B's invoice number, etc).
In my data I have 3 rows of information.
I selected range J3:J5 and created a new Conditional Formatting rule.
Select Use a formula to determine which cells to format
Use this formula =J3<>VLOOKUP(F3,$B$3:$D$5,3,FALSE)
Set the fill color when it fails.
J3 equals the first dollar value of your second set of data
F3 equals the first invoice number of your second set of data
$B$3:$D$5 is the full range of your first set of data
What this formula does is check to see if J3 does not equal the invoice amount for the corresponding invoice number in the first set of data.
It will work even if the invoice numbers are in a different order.
This is my result:

Resources