I got a seemingly simple question that I cannot find an answer for, most likely due to my limited Excel vocabulary... Any help would be much appreciated!
I update our company's catalog on a frequent basis, and this involves updating the prices of thousands of products. We keep an Excel version of the price lists for our clients, and these files need to stay up to date as well. All the company files have simple currency values in them, and I'd like to be able to update them all with a cell that contains a percentage multiplier. To better illustrate my needs, here's an example:
Col A Col B
1 $5 105% (multiplier)
2 $10
3 $15
I'm looking for a way to quickly and uniformly insert part of a formula "=$B$1*" into any selected range of cells A1:A3 (which already have values in them) so that their formula line would individually appear as "=$B$1*cell.value*" and produce an updated price, as opposed to "=$B$1*cell.reference".
Ultimately though, I am seeking a method that would allow me to simply change the multiplier cell and the associated range of existing prices would adjust automatically. But I want to do so without deleting or retyping the existing column of prices. If there are smarter ways to do this, please advise.
PS** I know I can Paste Special and modify a selected range of cells (multiply by the value of another cell), but I feel like the multiplier scenario would be even faster since most product categories increase a certain percentage every time there is a change.
something like:
Sub CellFormula()
Dim Cell As Variant
For Each Cell In Selection
Cell.Formula = "=$B$1*" & Cell.Value
Next
End Sub
this?
You can use the find and replace, which will look in formulas. Once it's set up, you can replace all. There is also a feature to use regex expressions in this dialog.
Related
I have 18 different ranges on 1 sheet that have names and totals in them. Each range has a list of names with a quantity next to it and a total at the bottom. I can't just search the complete sheet due to the fact that if the same name appears next to every quantity in one range that name also appears next to the total for that range. I need to look up the names and sum the quantities of just the ranges not the totals. I currently use
SUMIF('NC Sign'!$C$3:$C$12,PTS!$B$20,'NC Sign'!$D$3:$D$12)+SUMIF('NC Sign'!$E$31:$E$57,PTS!$B$20,'NC Sign'!$E$31:$E$57)+SUMIF('NC Sign etc....
This is very cumbersome and makes for some extremely long, slow formulas. Does anyone have a better way to do this. P.S. I need this to be accomplished in formula not VBA.
Maybe you may use this
=sum(filter({'NC Sign'!$D$3:$D$12,'NC Sign'!$E$31:$E$57,etc};{'NC Sign'!$C$3:$C$12,'NC Sign'!$E$31:$E$57,etc}='PTS'!$B$20))
But I don't know about how slow it is.
(Pictures included) -
I'm trying to write a formula that sums the Forecast Qty (dynamic range) based on multiple criteria. The criteria I want to base it on is the Part number and the month (Aug-21, Sep-21 etc). Each part can have multiple forecasts for each month, I've ran a match formula that shows the first row in which each part changes, but am not sure how to necessarily break it down further into months.
The previous pictures will give more insight into what I want. The first picture shows my raw data and the Match function I performed to find the first row of corresponding part. The second picture shows where I'd like the end result. The '100' in the selected cell is the result of the formula I have ran below.
=IF(VLOOKUP(F2,HIghJump!B:F,4,FALSE)>DATEVALUE("9/01/2021"),SUM(HIghJump!F2:F6))
My issue is how do I get the range in the sum formula (F2:F6), to change based on corresponding month. Beyond that, how do I get this formula to change based on different parts and different numbers of forecasts per month.
Any help is greatly appreciated!
Use SUMIFS:
=SUMIFS(HIghJump!$F:$F,HIghJump!$B:$B,$F2,HIghJump!$E:$E,">="&EOMONTH(K$1,-1)+1,HIghJump!$E:$E,"<"&EOMONTH(K$1,0)+1)
This should go in L2 and copy down. Change the K$1 to each corresponding target date when moving over columns.
If I am understanding correctly and if you have the newest version of Excel, then FILTER will come in handy.
Try:
=SUM(FILTER(HIghJump!F:F,
(HIghJump!B:B=$F2)*(HIghJump!B:B>=K$1)*(HIghJump!B:B<EOMONTH(K$1,0)+1))
Note that it is generally considered best practice to use partial ranges (e.g. $B$1:$F$100 and $B$1:$B$100 instead of B:F and B:B), so that might be something you would want to consider if performance is of importance to you. Also make sure your sheet name is really "HIghJump" instead of "High Jump" or some variation.
Answer:
Had to create a column using MONTH(x), then base SUMIFS off that vs the original month column.
=SUMIFS(HIghJump!F:F,HIghJump!H:H,MONTH(K$1),HIghJump!B:B,F2)
I am trying to perform ratio analysis for a collection of financial statements, each of which are contained in a separate excel worksheet. The layout and format of each sheet is exactly the same. See below.
Financial Statement Sheet
For the ratio analysis section I have a separate worksheet where I want to make an array of the computed ratios. See below.
Ratio Analysis Sheet
Unfortunately, I really don’t want to click through each worksheet to create these formulas and would rather write a script with a FOR loop. Since I need to find a ratio for every year of the financial statement the formula itself will need to continuously shift columns to derive a ratio for every year.
This is where I’m stuck. I’m not sure how to loop through every cell of my ratio summary array and use a formula that also changes for each year of the financial statement. I’m thinking I need to make a nested for loop, but I’m really not sure how to attempt the script.
Can anyone do me a huge favor and suggest how I might even start planning this out?
My VBA Developer Console
Here's what I have started, but I need more to figure this out. I don't think my formula will shift columns with this script, and I need help putting the computed values into the array on the ratio analysis sheet.
Sub Current_Ratio()
Dim Current_Ratio As Integer
Dim FirstYear As Long, LastYear As Long
FirstYear = 2015
LastYear = 2019
For i = 1 To Worksheets.Count
If Worksheets(i).Name Like "*Balance Sheet*" Then
For y = FirstYear To LastYear
Current_Ratio = Worksheets(i).Range("F21").Value / Worksheets(i).Range("F51").Value
'need line to place the computed current ratios into range B3:B37 on sheet17(Ratio Analysis)
Next y
End If
Next i
End Sub
Are you open to a formula solution rather than VBA? Here's how I would try it first. I say "try it" because the INDIRECT() function is slow and if you have too many formulas you might not like the performance. But I wouldn't make that judgement until I tried it.
I have a sheet named Company 1 Balance Sheet and in B21:D21 I have 10, 15, and 20 respectively. In B51:D51 I have 20. I also have a sheet named Company 2 Balance Sheet that has the same numerators but 30 as the denominator.
Here is the formula in C2
=INDIRECT("'"&A2&" Balance Sheet'!"&CHAR(66+VALUE(SUBSTITUTE(SUBSTITUTE(B2,"T-",""),"yr","")))&"21")/INDIRECT("'"&A2&" Balance Sheet'!"&CHAR(66+VALUE(SUBSTITUTE(SUBSTITUTE(B2,"T-",""),"yr","")))&"51")
I started by pointing and clicking to build this formula
='Company 1 Balance Sheet'!B21/'Company 1 Balance Sheet'!B51
Then I used INDIRECT to build that formula as a string so I could change the inputs. Let's take just the numerator portion because it works the same for both. My company is in column A, so I can start by replacing that part of the formula
=INDIRECT("'"&A2&" Balance Sheet'!B21")
The Balance Sheet portion of the name will be consistent, so I'll leave that. I'll need to change the B to refer to the proper year. I'll start by making that variable. The letter B is 66 in the ASCII character set.
=INDIRECT("'"&A2&" Balance Sheet'!"&CHAR(66)&"21")
Now I can add whatever year I want to 66 to increment that. My year is in column B, but it has a lot of crud around it. First I need to isolate the numeric portion
=SUBSTITUTE(SUBSTITUTE(B2,"T-",""),"yr","")
That gets rid of the stuff around the number. Then I use VALUE to turn it into a number. I can add that number to 66 so that T-1yr refers to 67 which is C.
And that's it. It's a little painful to set up, but once it's done, you just copy it down. Note the Div/0 errors means you don't have data for that year. Once you're formulas are working the way you want, wrap it in an IFERROR() function to hide those.
In your example, the company name is not repeated on every row. That doesn't work well for this method, but you can have a column where the company is repeated a simply hide that column if your particular presentation is important.
Other things you can with hidden columns: Put in the sheet's name if you don't consistent sheet names or if you just want the formula to be a little easier to read. You could also put the 21 and 51 in hidden columns and refer to those in your indirect function.
I've a question regarding columns and finding non zero values with there labels.
Hopefully the pictures will make my problem/struggle a bit better to understand.
Basically, there are columns to the right that show labels and hours that a team loaned in or out.
The values are found through a formula that shows per label the totals amount of hours spent.
Now I want to have on my overview page the two columns to the right with only labels showing the labels that contain hours. I've tried to use multiple if variables but that didn't seem to work :(
So at the end it should show something like this (I now manually typed the labels and data):
I did a quick recreation of your data structure to test this.
Using Array Formulas should get you the desired results in the current structure of your worksheet:
For range Loaned in you'd need the formula to be
=IFERROR(INDIRECT(ADDRESS(SMALL(IF($I$4:$I$14>0,ROW($4:$14),""),ROW(A1)),8)),"")
Where 8 is a reference to the return column. For the range directly to the right, you'd use the same formula, just adjust 8 to 9. And for range Loaned Out you'd need
=IFERROR(INDIRECT(ADDRESS(SMALL(IF($K$4:$K$23>0,ROW($4:$23),""),ROW(A1)),10)),"")
And for the range directly to the right you would again change the 10 to a 11. Again, both of these are array formulas, so they have to entered slightly differently. See the link for further assistance with array formulas.
This is not trivial. If you cannot work with filtering or programming, you should make use of matrix formulas. I include an example with two formulas: 1st in D1:D5, 2nd in F2:G5. Enter them with Ctrl+Shift+Enter. Also, you should use an extra column to determine the "valid" rows. (You could put it all in one formula, but it would look even more complicated.)
Sorry for German excel. Wennfehler = iferror, kkleinste = small, zeile = row, wenn = if, bereich.verschieben = range.offset.
i have a little problem with final formulas in one of my column. How to start. maybe i will explain what i have a then what i want.
i have an excel worksheet with 3 sheets. i want to record goods and what are these goods made of. first is sheet called Goods where is possible to put number of goods i want to make. In this case i want to make 1x sandwich1 and at the same time 3x sandwich2. i dont want make sandwich3 this time.
Second sheet is Matrix sheet where I record every good and what it is made of. This sheet is basic sheet and all other sheets take list of goods (resp. ingredients) from this sheet. Simply when i want to make sandwich1 i look at matrix and know that i need 1x1pc of egg + 1x5g of cheese. And for 3x sandwiche2 i need 3x10g of sausages.
Final sheet is called Ingredients. It is a list of used ingredients from Matrix sheet (exactly same order) to make these sandwiches. I want to fill formulas into column B which would go through one ingredient ofter ingredient and count needed amount of it. So it would look into matrix in the same row and where there is some number it would multiply with number of items from Goods sheet. The list of goods is also in the same order as in the matrix sheet.
I hope you understand now what i want and will try to help me. I think there will be SUMPRODUCT, SUMIF and maybe INDERECT functions but i am not that skilled in excel
thanks for any suggestions
You can use MMULT function here - it's an "array formula" which you need to enter in a range. You can do that like this:
In Ingredients worksheet enter this formula in B2
=MMULT(Matrix!C2:E4+0;Goods!B2:B4+0)
[I'm assuming you have a European version of Excel where ; is used to separate arguments]
Now select the whole range B2:B4, press F2 key to select formula and hold down CTRL and SHIFT keys and press ENTER. This "array enters" the formula in the range and you should now see curly braces like { and } around the formula and also the correct results.
You cannot change part of that array now, only the whole thing
Note that I'm assuming that the contents of Goods!A2:A4 will be the same as Matrix!C1:E1 and in the same order. You can extend the ranges to be as large as you like as long as that principle still holds
I suspect that this is an issue of "when all you have is a hammer, every problem is a nail". For reasons known only to you you are using a spreadsheet to solve a problem that databases were made to do. Any solution to this problem in a spreadsheet will be entirely dependent on the integrity of your data - add another column or get things out of order and it will fail.
That said, what you have in your link is effectively a pivot table and what you need is the unpivoted version of this - the instructions for getting this are here.
When you have that, you can use the various database functions in excel to get your answer.