SUMIFS with horizontal range and column header Excel formulas - excel

Here is a picture to visualize what I want:
I'm basically trying to sum each row separately based on the value in column A.
I tried with:
=SUMIFS(A1:D4,A1:A4,F1)
And obtain #Num
Because it's based on header values.
I tried to transpose the data range also without luck.
Is there a smart way of doing this insted of summing a row at a time?
I'm trying to avoid range command, where ctrl+shift+enter must be used to obtain a result.

In F2 either try:
=SUMPRODUCT(($A:$A=F1)*$B:$D)
Or:
=SUMPRODUCT(($A1:$A4=F1)*$B1:$D4)
Where the specific range references would impact your performance way less! Drag right.

Related

Excel, nest counta function into range of sum function

I want to expand range of sum when new cells are added in down.
My first try was nesting counta function into range of sum function but it didn't work.
=SUM(I4&":I"&COUNTA(I:I))
Anyone has any idea about how to do it?
The shown solution does not work when there is an empty cell in the SUM range
It would be safer to just use:
=SUM(I:Ï)
to summarize the entire column.
If summing the entire column isn't possible I suggest to make an Excel Table column out of your data.
Excel Tables adjust automatically when new data is added. This is best practice.

How to paste one occurrence of filtered category to a new column in EXCEL

I have a table with several rows for each category(column) and a corresponding score for them in excel. I want to get the sum of all scores for each category(I will use the SUMIF formula). I want to know how to extract one occurrence of each category name onto a separate column without manually typing it. Is there a formula or a shortcut that I could use?
This can be easily achieved by using the UNIQUE function. Suppose you have the following data as an example in the range A1:B8:
Now simply copy your headings into, e.g., the columns D:E and enter the following formulas in the cells D2 and E2 respectively:
=UNIQUE(A2:A8)
=SUMIF($A$2:A8;D2;$B$2:$B$8)
Adjust the arrays to your needs and you should have solved your problem. The final output looks as follows:

Copy the Excel RANK formula without changing the end reference

Suppose I have a simple spreadsheet with 3 rows of data that I want to rank in separate columns. The example I will use is simple, but my actual dataset is 12k + rows. In this simple example, I want to use the RANK formula from Excel to do this. To rank the values in column Police, I'll use the formula =RANK(B2, B2:B11, 1), with B2:B11 being the range.
As I mentioned, my actual dataset has thousands of rows and many more columns to compare. Even in this example, I want a simple way to copy the formula to all of the other _RANK column cells. If I simply copy the cell to the other cells, +1 gets added to the cell value. This is what I want to happen, EXCEPT for the ending cell of the range.
As you can see above, this is incorrect. The formula gets set to =RANK(B11,B11:B20,1) for cell E11, when what I want is =RANK(B11,B11:B11,1). How can I easily copy this formula across multiple cells so that it is has the correct formula?
Placing $ before the cell references makes it static. Try changing your formula to Rank(B11, B$2:B$20,1). Coping this formula will only change those references which are not proceeded with $.

excel link table range to value

I'm searching for a way to link the range of an Excel table to a specific number.
Let's say I have a table that has a range of A1:B10. I want to make the number '10' dynamic and link it to a number that is calculated from another sheet. Let's say cell F1 contains that number and the value is '20'.
Is it possible to make a dynamic range so the table range changes to: A1:B(F1). Then my table would adapt automatically and this has to work in my file.
I prefer a formula instead of a macro in VBA, because I normally don't work with VBA.
An alternative is to use a dynamic named range which is what we used to do before tables. The range, enclosed by marching ants below, is defined as follows:
=OFFSET(Sheet3!$A$1,0,0,Sheet3!$F$1,5)
The top left cell is A1. It is as many rows deep as the number in F1 and 5 columns wide (which could also be made dynamic).
Yes, INDIRECT is your way to make any formula dynamic / dependent on other cell values.
Say you want to sum range A2:C2. But the value 2 for C is located in Cell G2.
=SUM(INDIRECT("A2"&":C"&G2))
this is equal to write =SUM(A2:C2) in my example below.
If you set G2 to 3 it would calculate A2:C3 for this =SUM(INDIRECT("A2"&":C"&G2)).
If you mean Excel table, I guess the answer is no with formula, probably with VBA.

Unique value in excel

I have an array of numbers in Excel spanning from Cells B1 to F49. Out of all those numbers I want to find out the unique values, in other words, no duplicates. I tried using Remove duplicates but it looks at the rows and not the individual cells. What would be my best option for doing this? any help would be greatly appreciated.
You could try this array formula that returns unique text or numbers from a rectangular range.
Select a range to output the results to eg: H1:H245
Copy and paste the formula below into the formula bar.
Press Ctrl+Shift+Enter to enter into the range.
=IFERROR(CELL("Contents",INDIRECT(T(IF(1,TEXT(MODE.MULT(IF(FREQUENCY(COUNTIF(B1:F49,"<="&B1:F49)+ISTEXT(B1:F49)*COUNT(B1:F49),COUNTIF(B1:F49,"<="&B1:F49)+ISTEXT(B1:F49)*COUNT(B1:F49))>={1,1},MODE.MULT(10^5*ROW(B1:F49)+COLUMN(B1:F49),10^5*ROW(B1:F49)+COLUMN(B1:F49)))),"r0c00000"))),0)),"")
I'd probably put this formula in column C: (or another empty column you have):
(so starting in cell C1: )
=COUNTIF(B:B,B1)=1
(and copy/paste the formula down)
It will return TRUE if it is unique. So you can then filter things out via Filter, or with other formulas down the road.
It may be easiest to just combine your information into one long column and run a remove duplicates. If this is not an option you may want to look at writing a macro to crawl through the records.
You could have a macro go through each column for the rows specified and determine if the CountIf function =COUNTIF(B2:F49,B2) returns a value >1
if it does there are at least 2 instances of this number.
I'm not sure how you want to identify your unique cells but you could potentially set a text color or return the values of the cell to another location.
Simplest for identification of values unique within the entire array may be to highlight the entire range with ‘standard’ formatting of choice for uniques, then select the entire range, Conditional Formatting, Highlight Cell Rules, Duplicate Values…, and choose a custom format of no fill and font of whatever you started with.

Resources