SUM of multiple columns text in Excel - excel

Is the first time writing a command in excel so I have no particular idea what I'm doing.
As you can see from the image I'm trying to get in the "All Stores" column all the Stores that have the "X" in them.
At the moment the command that I'm using is displaying the output of the first cell where it finds an "X".
I have looked at some examples that I found on this topic, but I didn't find something concrete. I've tried to do it with "SUMIF" and also I've tried to use "&" in from and after "B2", "C2", "D2", but all I got was an error.
Everything that I found on this topic was how to combine numbers.
In this particular example the expected result would be "Store1, Store3".
Thank you for your support!

Yyou could use the following:
=TEXTJOIN(", ",TRUE,IF(B2="x",B$1,""),IF(C2="x",C$1,""),IF(D2="x",D$1,""))
And populate down for other products
Though it could get unwieldy if you have a lot of stores. I'm pretty sure someone else will come up with a more clever answer, but I can't think of anything else at the moment.

In E2 enter the array formula:
=CHOOSE(COUNTA(B2:D2)+1,"",INDEX(B$1:D$1,MATCH("x",B2:D2,0)),TEXTJOIN(", ",TRUE,IF(B2:D2="x",B$1:D$1,"")),"All stores")
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.
The logic is:

First of all, I image you have over several columns that you want to consider. SO you can get this date in a new worksheet by replacing "x" or a mark of choice using below formula:
=IF(A2<>"", A$1, "") just autofill to get all the values in the new worksheet.
Now focussing on the new worksheet. e.g.
Apply below formula to get the required result
=IF(COUNTA(H2:J2)-COUNTBLANK(H2:J2)=COLUMNS(H2:J2),"All Stories",TEXTJOIN(",",TRUE,H2:J2))

You can try this array formula:
=IFERROR(TEXTJOIN(",",TRUE,INDEX($A$1:$F$1,1,AGGREGATE(15,6,1/(B2:F2="X")*COLUMN(B2:F2),N(IF(1,ROW(INDIRECT("1:"&COUNTA(B2:F2)))))))),"")
To enter/confirm an array formula, hold down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula seen in the formula bar.

Related

How can I pull any cells with a value greater than a number?

I asked a similar question to this here but I realized the >=1400 can be either before or after my "x".
I'm trying to look at the number of users who are on screens larger than 1400. I have my Excel sheet, and tried doing an IF statement, but because of the "x" in the middle, it's not working properly and is instead just pulling all of the cells, even the ones with screen sizes less than 1400. I want to be able to pull all cells with Screen Resolution values larger than 1400 on either the first or second number.
All of the numbers highlighted in yellow would be the ones pulled.
I've tried doing slight variations of the =IF(--LEFT(A2,SEARCH("x",A2&"x")-1)>1400,A2,"No") but I can't find the right format to narrate that I want the formula to look at both numbers on either side of the "x".
You can try this:
=IFERROR(IF(OR(VALUE(LEFT(A2,SEARCH("X",A2)-1))>=1400,VALUE(RIGHT(A2,LEN(A2)-SEARCH("X",A2)))>=1400),A2,"No"),"")
Another option with array formula:
=IF(OR(FILTERXML("<a><b>"&SUBSTITUTE(A2,"x","</b><b>")&"</b></a>","//b[1 or 2]")>1400),A2,"No")
Array formula after editing is confirmed by pressing ctrl + shift + enter
As you are using Excel365 then try below formula.
=FILTER(A2:A10,(--TRIM(LEFT(SUBSTITUTE(A2:A10,"x",REPT(" ",100)),100))>=1400)+(--TRIM(RIGHT(SUBSTITUTE(A2:A10,"x",REPT(" ",100)),100))>=1400))
Or use-
=FILTER(A2:A10,(FILTERXML("<t><s>"&SUBSTITUTE(A2:A10,"x","</s><s>")&"</s></t>","//s[1]")>=1400)+(FILTERXML("<t><s>"&SUBSTITUTE(A2:A10,"x","</s><s>")&"</s></t>","//s[2]")>=1400))
As an alternative to using a complicated formula, you could just split the data up.
Create two new columns next to column A. Then use text to columns and delimit on the “x”.
In the E column use a simple formula of
IF(OR(B2>=1400,C2>=1400),”True”,”False”)

How to declare a two-dimensional array by one cell formula?

In Excel it is pretty simple, for example
={1,2,3,4;5,6,7,8} gives us 2 rows in 4 columns.
But when I try similar in Google Spreadsheet, it fails.
EDIT: See comments below where the language version issue was revealed.
Nearly the same syntax, but different entry methods:
Excel
Hi-light a block of cells and array enter:
={1,2,3,4,5,6,7,8}
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.
Google Sheets
Select a single cell and enter:
={1,2,3,4,5,6,7,8}
and the extension to the other cells occurs automatically:
Same is true for 2-D arrays:
If you are using Google Sheets, remember to leave enough empty cells to the right and below to hold the result.

Data generation in Excel

Good morning, I am new at using excel and I'll be very thankful if someone can help (and I'm sure that the answer is easy from your point of view).
https://img15.hostingpics.net/pics/785039data.png
The screen capture reprents a simplified way of explaining what I am looking for:
For each number in the first column (which can appear more than once), I want to generate a corresponding Id (See column Id to affect which is the type of data).
We are only looking at the beginning of "Number", which can be up to 8 number is size.
Sometimes there can be tricky case, as te example starting with 40 vs 402 which are not affected to the same Id.
As I am new on excel maybe this answer or question exist but I don't know how to search/name it.
Thank you for your help, have a great day.
Tricky formula. Not exactly the prettiest thing ever but this formula works: (Line breaks added for readability)
= IFERROR(INDEX(D$2:D$7,MATCH(MAX((((A2-(C$2:C$7*10^(CEILING(LOG10(A2+1),1)
-CEILING(LOG10(C$2:C$7+1),1))))=MOD(A2,10^(CEILING(LOG10(A2+1),1)
-CEILING(LOG10(C$2:C$7+1),1))))+0)*C$2:C$7),C$2:C$7,0)),"(no match)")
A few things to note:
You didn't include cell ranges so you will have to manually change the cell ranges in the formula above to whatever your particular cell ranges are.
This is an array formula, meaning after you enter this formula into a cell, you must press on the keyboard Ctrl+Shift+Enter rather than just Enter.
The formula looks for the "strongest" match. For example, if a number is 40200000, the formula would return "Grapefruit" because it is a stronger match than "Grape".
If no match is found, I just have the formula return "(no match)" but you can obviously change that to whatever you want.
I assume this won't be an issue, but the formula will not work if any negative numbers are used.
See below, screenshot that shows formula works for your data.
You can try this array formula (click Ctrl + Shift + Enter together) from cell B2 and drag it down:
=IFERROR(INDEX(D$2:D$7,MATCH(MAX((VALUE(LEFT(A2,LEN($C$2:$C$7)))=$C$2:$C$7)*C$2:C$7),C$2:C$7,0)),"")
This will try to match the longest number (with MAX) and return the value (with INDEX/MATCH).

numbers treated as text giving wrong values in index and sumifs

I'm indexing a table that somehow has numbers stored as text, here is a fragment:
{0\0\0\0\"110"\950\0\0\0\"3485"\0\0\0\"950"\0\0\0\0\0\100}
When I try to use sumifs for this range, i get wrong values. Is there any way to fix this in formula without changing the data?
This is the exact formula I'm using:
=SUMIFS(INDEX(INDIRECT("'"&"P_"&$C$3&"'!B9:BC100");MATCH($D6;INDIRECT("'"&"P_"&$C$3&"'!BC9:BC100");0););INDIRECT("'"&"P_"&$C$3&"'!B1:BC1");L$1))
You cannot use SUMIFS but there's a work-around.
Something like:
So if you have data like above, enter this array formula:
=SUM(IF(INDIRECT("A3:A5")=A$2,VALUE(INDIRECT("B3:B5"))))
by pressing Ctrl + Shift + Enter.
300 is entered as Text but you still get the correct total for all items equal to A$2 which is A.
Note: My local separator is , (not ; as in your example) so don't be confused.
Also, above is just an example, I'll leave the actual adaptation of your formula to you. HTH.
If you have ranges with numbers stored as text a good way to deal with this is to multiply your cells by 1 as you use them. Example below. You need to leave out the curly braces and press Ctrl+Shift+Enter to enter the formula, which tells excel to individually multiply each number by 1 before summing them (in my example)
Therefore, you might try the following formula with your data
{=SUMIFS(INDEX(INDIRECT("'"&"P_"&$C$3&"'!B9:BC100")*1;MATCH($D6;INDIRECT("'"&"P_"&$C$3&"'!BC9:BC100")*1;0););INDIRECT("'"&"P_"&$C$3&"'!B1:BC1");L$1))}
Note: I haven't tested this formula, but I did test that this method works with INDIRECT()

Excel How to find more values that contain values in the cell next to them?

I want to use the Index formula to list data in my excel sheet.
I want to list the data of the column A that contains "finished" in the corresponding cells in column E.
Currently I'm using the following formula:
=INDEX(IMs!A:A;MATCH("finished";IMs!E:E;0))
The problem is, only the first value appears. I want to list ALL of them.
Is it possible with the vlookup formula?
Thank you very much in advance.
Kind regards,
Vanessa
First enter this formula in B1:
=COUNTIF(IMs!$E:$E,"Finished")
Then enter this array formula** in your first cell of choice:
=IF(ROWS($1:1)>$B$1,"",INDEX(IMs!$A$1:$A$1000,SMALL(IF(IMs!$E$1:$E$1000="finished",ROW(IMs!$E$1:$E$1000)-MIN(ROW(IMs!$E$1:$E$1000))+1),ROWS($1:1))))
Copy this formula down (though not the one in C1) until you start to get blanks for the results.
If the upper row reference that I chose (1000) is not sufficiently high, then change it as required. Note, however, that since this is an array formula, it is not recommended that you make this upper bound too high (and certainly don't reference entire columns!), since this will have a significantly detrimental effect on spreadsheet performance.
From your post, it also appears that you are using a version of Excel in which the argument separator in formulas is not the comma but the semi-colon. If this is indeed the case then you will need to make the necessary amendments to the formulas I provided.
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

Resources