I want to make a ledger with multiple currency, problem i m getting is in running balance
Use this in your G6 cell.. then drag downwards.
=IF(ISNUMBER(G5),G5,0)+IF([#Currency]=$D$1,[#Debit],0)-IF([#Currency]=$D$1,[#Credit],0)
You may edit the $D$1 & G5 to match the other currency/column.
idea : if top = value, copy. If debit/credit = have value, add/minus from the copied value.
Please share if it solves (or not)..
Related
I am trying to change the Master Key to a “new key” if the origin and destination match the old key.
Basically the master key from table 1 will look to see if the key exsists in Table 2, if it does it will pull the new Key. If the master key does not exist in Table 2 it will not change. It will be the original origin and destination.
I have tried using if statements with vlookups however I am getting stumped with the logical error. Does anyone know how to return the new value or if there is another way to solve this?
I have attached an example.
In the example, in table 1 the Master key is made from London and Italy together. This master key needs to be looked up in Table 2 (located in Column A) If it’s there it will pull the New Key (Column D).
Try this formula in D2 of Sheet1 and drag it down,
=IFERROR(VLOOKUP(A2,Sheet2!A:F,4,FALSE),A2)
I would use an Index/Match solution rather than a vLookup. vLookup is great for simple tasks, but it doesn't usually work whenever you try to do anything more complicated. I now find it is a simpler solution almost everytime (though I am not sure how it compares in performance).
Try something like this in your table1 cell D2:
=IFERROR(INDEX(Sheet2!$A$2:$F$4,MATCH(Sheet1!A2,Sheet2!$A2:$A4,0),4),Sheet1!A2)
What this will do is starting with the Match portion:
It will check the list in Sheet2 A2:A4 for a match of the same string as in Sheet1 cell A2. If it finds it, it will return a row number, if not it will return an error.
Next, the INDEX takes your second table as a source, and uses the row number determined in the Match and the fourth column (which is column D), and returns that value. If the Match returns an error, this will also return an error.
So, we use the IFERROR to capture the situation where the MasterKey in Table 1 does not exist in table 2. In that situation, I am assuming you just want to keep the same MasterKey from Table 1, but you can change that to anything you like.
If that works, you simply drag the formula down from Sheet1!D2 down to Sheet1!D4. Also, if your Table2 is much bigger then you have shown, you will need to adjust the Index and Match inputs to reference the correct range size. Keep in mind the use of "$" as they will prevent the formula from changing those cells when you drag it down.
What I am trying to do is find a formula that I have been unsuccessful in locating and alter it to what i need it for. What I have is a list where names are duplicated throughout with different values on either side of the name. I would like to be a way where specific thing happen.
I will try to explain and give an example.
In Column A I have all of the names, not in any particular order, just all jumbled. In column B I have a time or the value "off" if someone is not scheduled for that day. What I would like to do is is find each instance in which "John" is working and return the value if it does not say that he is off or vacation.
Example
The formula I have that shows every instance is here. This would reside in D2:
Code:
={IFERROR(INDEX('$B:$B,MATCH(0,IF($C$2=$A:$A,COUNTIF($D$1:D1,$B:$B),""),0)),"")}
The formula I tried but have not had any success is here:
Code:
={IFERROR(INDEX('$B:$B,MATCH(0,IF(NOT(OR("Off"=$B:$B,"Vacation"=$B:$B)),COUNTIF($D$1:D1,$B:$B),""),0)),"")}
Any help would be appreciated!
Made some changes in your formula:
=IFERROR(INDEX($B:$B,MATCH(0,IF(($C$2=$A:$A)*("Off"<>$B:$B)*("Vacation"<>$B:$B),COUNTIF($D$1:D1,$B:$B),""),0)),"")
This is an array formula so commit it by pressing Ctrl+Shift+Enter.
Referring whole column (like $A:$A or $B:$B) in array formula makes execution very slow and hence is not advisable, instead use the range with data such as
=IFERROR(INDEX($B$1:$B$9,MATCH(0,IF(($C$2=$A$1:$A$9)*("Off"<>$B$1:$B$9)*("Vacation"<>$B$1:$B$9),COUNTIF($D$1:D1,$B$1:$B$9),""),0)),"")
I found slightly different formula than what you are trying to use, but it might help you. (in the codes below "John" is in C2)
=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B:B)/((B:B<>"off")*(A:A=$C$2)),COUNTA($A$1:A1))),"")
if you want it to remove also "vacation" then
=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B:B)/((B:B<>"off")*(B:B<>"vacation")*(A:A=$C$2)),COUNTA($A$1:A1))),"")
in my localization I am using ";" instead of your "," (I already changed that in the examples) so there might be some other minor changes you need to apply to the code... btw you dont need to enter this as array formula.
I am trying to use Sumproduct dynamically on a sheet that will be updated regularly.
My motive is to not manually select the columns ( i.e. not to use the shift key and down key to select the range A2:A6 as seen in the attached snapshot)
I want to have the formula "=SUMPRODUCT(--(A2:A6="TX"))" pick up the A2:A6 dynamically since my data in worksheet say A is everchanging. So that when the data has grown to A8, it can be somehow picked up dynamically than manually using the keys.
Can this be done? Please let me know if my question is not clear.
Screenshot of my xls
Regards
SM
Yes, you could define the range dynamically. However, given your current formula, I see no reason why you should not switch to COUNTIF here, i.e.:
=COUNTIF(A:A,"TX")
a function for which the use of entire column referencing (A:A here) has no detriment to performance (which is not at all the case with SUMPRODUCT).
Regards
Shitty recommendations guy, here.
Can you insert a new line above all in your sheet? You could put it really wherever you want and you can even hide it, the first line just works for me.
If you can, just make it an "count.values" function on the entire column with an appropriated subtraction to adjust the count to the right length of your data. E.g. Removing this auxiliary cell value plus a header would be "=count.values(A:A)-2".
Later, on your VBA, you could retrieve this value to a variable and concatenate it to your main function. Lets say you made the auxiliary on cell A1 (coordinates 1, 1)
Dim auxLine As Integer
auxLine = cells(1, 1).value
whatever.formular1c1 = "=SUMPRODUCT(--(A2:A" & auxLine & ="TX"))"
i have 2 cells A1 and B1. A1 is connected to an api data feed so the value is changing practically every second. when its value is >= to B1, how can i hold lets say a value of 1 in cell C1. even if the value in A1 moves above and below B1? i'm trying to hold and store a value of 1 to trigger my worksheet_calculate().
C1 =IF(A1>=B1,1,0)
I would suggest that you use a modular variable to keep your value rather than an excel cell, then this value can update an excel cell(s) of your choosing on a frequency of your choice through conditions within worksheet_change or worksheet_calculate
Keep in mind however that worksheet_change and even more so worksheet_calculate fire quite often you may find this becomes a performance bottleneck if the VBA is not gated to only do payload work when absolutely necessary.
An alternative would be to develop a VSTO Add-In to handle your automation cases.
You might have problems with your api not triggering the worksheet calculate anyway in which case the c1 won't get evaluated.
You also might have issues with your api sending a value > x but your system being too slow to pick up that x.
You might want to see if your API offers a =Max( key , since ) , just Max( keyOftoday )
What you might like to do is record the history of a cell, in which case this article might help you. https://www.quora.com/How-can-I-record-a-current-cell-value-that-is-constantly-changing-on-another-Excel-sheet-at-a-specific-point-in-time
At which point it's just a matter of checking if any cell in your recorded range is > than B1
I'm not a programmer and I could not write code to save my life!
However, I have an Excel table that calculates allocated time for multiple resources. Currently, the formula I have written is not able to directly find the relevant rows so if the "Availability" row is not above the "Capacity" row the formula does not work as I would like it to.
The current formula I use is:
=IF(A8=A9, IF( B8 = "Availability", IF(D8=D9,0, IF(D8<0, -D8+D9, D9-D8)), ""), "")
I want the formula to look for the Resource Name and calculate the allocated hours between the "Availability" row and the "Capacity" row for each month. This formula would need to do this for each Resource Name and not duplicate results so one value for each Resource Name.
Thanks for taking the time to read this even if you are not able to help.
Try this:
=IF(B2 = "Availability",INDEX(D:D,MATCH(A2 & "Capacity",A:A&B:B,0))-D2,"")
The problem is that capacity is not always the one directly under availability. This is an array formula and must be confirmed by Ctrl-Shift-Enter. Put it in H2 the Formula box. Press Ctrl-Shift-Enter. Then copy down.
One note: It will speed things up if instead of the entire column references; D:D,B:B and A:A, you put the actual absolute range of data; $D$2:$D$300...
The SUMPRODUCT formula works great for this. I typically name the ranges but for this purpose, I included the first 1000 rows. This will give you the total hours for Month 1, where Resource Name = Name 1 and Category is Availability, regardless of order or the number of times each appears...
=SUMPRODUCT(($A$2:$A$1000="Name 1")*($B$2:$B$1000="Availability")*($D$2:$D$1000))
you can do the same for Capacity or if you need a difference...
=SUMPRODUCT(($A$2:$A$1000="Name 1")*($B$2:$B$1000="Availability")*($D$2:$D$1000))-
SUMPRODUCT(($A$2:$A$1000="Name 1")*($B$2:$B$1000="Capacity")*($D$2:$D$1000))