If function not working across multiple columns and multiple functions nested - if-statement

I’m having trouble with a function trying to get two cells to "merge"
I have 2 columns, Column D and Column G, both have either a number or #N/A in them. Column D represents package prices shipped with USPS, while Column G represents package prices shipped with FedEx. The only reason #N/A is in some of them is a lack of proper record taking. The function I have written now is as follows:
=IF(D2>0,D2,IF(G2>0,G2,x))
If does the first part fine, but when it gets to the part where I tell it to check column G, it comes up as #N/A.
Maybe this is the wrong route to take, but I'm hoping to have one column with these two columns combined so I can have a separate column next to it with what I actually charged for shipping and compare.
Any help will be greatly appreciated.
Thanks

(Assuming you are working in Excel or a similar tool)
Comparing text using > won't do what you want. "#N/A" > 0 is true. Use the istext() function:
=IF(istext(D2),if(istext(G2),x,G2),D2)

Related

Excel formula that checks the text of a specific column and the text of a specific row and returns the data listed in the table

I am trying to display the outcome scores on one Excel sheet into another Excel sheet based on the outcome name and course.
If the text in Sheet1!C2=communication and Sheet1!E2=Comm 2010, then display Sheet1!D2 on Sheet2!B3.
If the text in Sheet1!C4=information* and Sheet1!E4=Commm 3000, then display Sheet1!1D4 on Sheet2!C5.
Need to be able to use Wildcard when checking the text.
If the text in Sheet1!C6=communication and Sheet1!E6=Comm2010, but there is no number in Sheet1!D6, leave Sheet2!B5 blank
I have played around with a few different IF AND formulas, but I can't get the data displayed correctly.
Right now, I am building a pivot table from the data in Sheet1, then taking the table and formatting it to match the table on Sheet1 then using =IF(Pivot!C7="","",Pivot!C7). This works, but building a pivot table for each student and then formatting it to match Sheet1 is a time drain.
I'm really hoping there is a better way to do this.
Thank you!
Since you are compiling outcomes on a per-student basis and not in total it is safe to use the SUMPRODUCT() function:
The formula below is used in B3
=SUMPRODUCT((Sheet1!$E$2:$E$6=Sheet2!B$1)*(Sheet1!$C$2:$C$6=Sheet2!$A3)*(Sheet1!$D$2:$D$6))
and can be copied across and down throughout B3:C4
The formula used in B5 is different, because of the 'wildcard criterion'
=SUMPRODUCT((Sheet1!$E$2:$E$6=Sheet2!B$1)*(LEFT(Sheet1!$C$2:$C$6,11)="Information")*(Sheet1!$D$2:$D$6))
(unless you are using Microsoft 365, having the formula directly suppress 0 values essentially entails doubling it in length so, as an alternative, given the small output range, a custom-number format has been implemented, which effectively doesn't display 0 in a cell where that is the formula result)

If statement based on presence of duplicates

If the data in column A is found in multiple rows, look at the data in column C for those duplicate rows. Whichever is highest value in C, return the value from the respective row but column B. In my picture, I'm trying to populate the stuff in yellow automatically, ideally with formulas in excel. Any help is greatly appreciated.
enter image description here
My first attempt was this (a formula that you may copy on cell D2):
=INDEX($A$2:$C$9,MATCH(MAX(IF($A$2:$A$9=A2,$C$2:$C$9)),$C$2:$C$9,0),2)
This is what it does: the combo INDEX-MATCH does what VLOOKUP does, but it is more efficient than VLOOKUP. Basically it commands Excel to navigate the $A$2:$C$9 range and then find the following match:
Find the row with the MAX price for the same Item (this part: MAX(IF($A$2:$A$9=A2,$C$2:$C$9)));
Then return whatever value is on column B, at that row.
Albeit this formula seemed to work, I tried something out: what if, by some unfortunate coincidence, the MAX price for two items was the same?
This is what happens when CDE888 sells for 217
Thus, one can tell the formula above is wrong and needs a fix. This is the new formula:
INDEX($A$2:$C$9,MATCH(A2&MAX(IF($A$2:$A$9=A2,$C$2:$C$9)),$A$2:$A$9&$C$2:$C$9,0),2)
This time, the formula looks for a value that is composed of the Item code AND its highest price.
The rest works exactly as the first formula.
One last word: I wrote this formula on cell D2, then dragged the formula down.

Virtual array to be used into VLOOKUP and SUMIF formulas

I have the following tables
In Table 1 I have some items with relative quantity values. Beneath, I have a look-up table from which I can find the rule for summing up the item's quantities into the right Container.
Currently I use additional columns, one for each Container, for helping in succeding the task.
Each cell in additional columns has the following formula (ex. E4):
=IF(VLOOKUP($B4,$D$12:$G$17,MATCH(E$2,$D$11:$G$11,0),0)="x",1,0)
Then, each Container has a Sum of Values calculated as follow (ex. E3):
=SUMPRODUCT($C$4:$C$9,E$4:E$9)
The question is... Is there a way (no VBA) to obtain the same result without using additional helping columns?
I would like using something like this as formula (but it doesn't work):
=SUMPRODUCT($C$4:$C$9,IF(VLOOKUP($B4:$B9,$D$12:$G$17,MATCH(E$2,$D$11:$G$11,0),0)="x",1,0))
In short, I don't know if (and if yes, how) the helping columns in the sheet I use can be calculated on the fly from excel as virtual columns directly into a cell formula.
No limitations in the use of VLOOkUP and SUMIF functions -> SUMIF, SUMIFS, INDEX, MATCH and any other combination of Excel functions is fine as long as the goal of eliminating the help columns is achieved.
Any help on this would be really appreciated.
Thanks in advance to everyone
Try,
In E3, modified your formula and copied across right to G3 :
=SUMPRODUCT($C$4:$C$9,IF(VLOOKUP(T(IF({1},$B4:$B9)),$D$12:$G$17,MATCH(E$2,$D$11:$G$11,0),0)="x",1,0))
Or,
=SUMPRODUCT($C$4:$C$9*(VLOOKUP(T(IF({1},$B4:$B9)),$D$12:$G$17,MATCH(E$2,$D$11:$G$11,0),0)="x"))

How to alternate values of a =textjoin range in spreadsheets

first of all excuse my poor English, I'm trying to get the exact words to summarize my problem.
I'm trying to make a formula to concatenate a big range of cells by alternating its crossed values.
If you see the image, I have some titles (3rd row), and some variable values for each column from B to D, in the rows 5 to 7. The number of columns and rows will expand in actual project. Then, I need to summarize all crossed data to make some processes later: I need the output written at column F, where I get the title and then the cell value.
If I use =TEXTJOIN(",";;"$B$3:$D$3;B5:D5) I get the output at H5, but It makes me to get many problems later at processing information.
I have tried to make some extra columns or cells concatenating content of each "title" and "value", and then, joining everything, but it's a poor solution if I'm trying to build a sheet with hundreds of columns. I'm sure there would be another better solution, but I can't figure out by now.
your formula should be:
=ARRAYFORMULA(SUBSTITUTE(REGEXREPLACE(TRANSPOSE(QUERY(TRANSPOSE(
IF(B5:D<>"", ","&B3:D3&","&B5:D, )),,999^99)), "^,", ), " ,", ","))

Same row different column. Excel Formula

If is possible with the if(indirect formula to give me the value from the same row but from a different column if a specific cell is from that row?
More specific: I want cell =Sheet2!F23 to give me =Sheet1!N11 if =sheet2!C23 is from Sheet1!B11.
The important thing is the I need it to come from row 11 but from a different column.
Thanks in advance.
I did the following:
On Sheet 1 i gave all the rows a unique number in column A
On sheet 2 i just put in the unique number(C23) and the rest of the cells on that row used the formula below with. The only thing i needed to change was the index of which column needed to be matched.
It might not be the most efficient way but i worked for me.
=IFERROR(INDEX(Sheet1!B:B;MATCH($C23;Sheet1!$A:$A;0));"")