VLOOKUP doesn't work with complicated URL as cell content - excel

I have the following situation.
I use the function VLOOKUP in Sheet2, using a table array from Sheet1:
=VLOOKUP(A4,Sheet1!$A$2:$B$81,2,FALSE)
I am comparing URLs written in cells formatted as "text".
I basically try to mass replace some URLs with others.
When the URL is a simple one, such as the one below, the formula works fine.
http://www.website.com/page/ that becomes http://www.website.com/newpage/
The formula works fine and returns http://www.website.com/newpage/ in the range cell
When the URL is a complicated one, such as the one below, the formula returns #VALUE!
http://www.website.com/configurator/?dimensiuni%5B%5D=100&toate-categoriile=1&orice-duritate=1&toti-producatorii=1&orice-buget=1&toate_236=1&toate_234=1&toate_235=1&toate_237=1&orice_buget_233=1&toate_216=1&toate_196=1&toate_191=1&toate_211=1&orice_buget_190=1&toate_246=1&toate_244=1&toate_245=1&toate_247=1&orice_buget_243=1&toate_261=1&toate_259=1&toate_260=1&toate_262=1&orice_buget_258=1&toate_281=1&toate_279=1&toate_280=1&toate_282=1&orice_buget_278=1&toate_294=1&toate_292=1&toate_293=1&toate_295=1&orice_buget_291=1
should return
https://www.website.com/magazin/?orderby=price&product_category=tipuri-saltele&dimensiune_saltea=160x190-ro&stock_status=in-stock%2Con-backorder&min_price=30&max_price=9000&lang
but it doesn't. It returns #VALUE!
Any idea what I could do to make this work?
I suspect it's probably because the long and complex URL that it doesn't know how to compute it...
Thanks!

Related

Excel INDIRECT function gives #N/A, WHY?

I have the following excel formula:
=CORREL(INDIRECT("Raw0!"&COL_LETTER(Raw0!B$795)&MATCH("z";Raw!$B1:$B795;0)&":"&COL_LETTER(Raw0!B$795)&CELL("row";Raw0!B795));INDIRECT(COL_LETTER($B797)&MATCH("z";Raw!$B5:$B795;0)+ROW(B7)-1&":"&CELL("address";$B797)))
It looks complicated but the idea is rather simple, I want to define 2 arrays with INDIRECT functions in order to calculate cross-correlation between the arrays, i.e.:
=CORREL(array1;array2).
The above formula always gives me #N/A, i.e. excel error message "not available".
However, if I put the arguments of the two INDIRECT functions above in a couple of cells, let's say C803 and C804, and the I use the formula
=CORREL(INDIRECT(C803);INDIRECT(C804))
it works fine.
How is it possible? as cells C803 and C804 contains exactly the same writings I used in the first function above, i.e.:
C803 contains
="Raw0!"&COL_LETTER(Raw0!B$795)&MATCH("z";Raw!$B1:$B795;0)&":"&COL_LETTER(Raw0!B$795)&CELL("row";Raw0!B795)
and C804 contains
=COL_LETTER($B797)&MATCH("z";Raw!$B5:$B795;0)+ROW(B7)-1&":"&CELL("address";$B797)
Note: COL_LETTER() is a simple VBA function I created that returns the letter of the column of the cell argument. It works fine, I tested it.
Thanks for the attention.

How to use IF function in Excel to find a simple embedded term

I want to use Excel function to find a simple embedded term (partial find), and return another cell value. I managed to make a formula that sort of works, but I want to know if:
there is a more efficient formula to accomplish the same thing; and
Here is the formula: =IF(VLOOKUP("*"&B1,A6:B12,1,FALSE)="S-"&B1,VLOOKUP("*"&B1,A6:B12,2,FALSE), Not Found) This formula returns the value in B2 in the picture below.
A question/problem I have is that the wildcard "*" works in VLOOKUP but not in IF, so I'm stuck with manually entering the string "S-". Luckily the array i'm working with uses the same term ("S-") for all values, but that might change in the future and I'd like a way to deal with that. This causes the formula not to work when there is text after the number, as in the last cell in the example.

MS Excel: COUNTIFS doesn't work when A criteria cell is empty

I would really appreciate some help whit my problem. I tried to read about it but nothing I found works.
I am trying to pull some data from another spreadsheet based on multiple criteria /entered in cells B4:B6/.
B4 - Customer Name
B5 - FROM Date
B6 - TO Date
I want to be able to extract data based on only one cell or any combination of them.
/B4&B5,B4&B6,B5&B6,B4&B5&B6/
I tried using the following formula:
COUNTIFS(JOBS!$C$1:$C$10000,$B$4,JOBS!$L$1:$L$10000,">="&$B$5,JOBS!$L$1:$L$10000,"<="&$B$6)
The formula works fine if all cells /B4:B6/ are filled but returns #NUM! if one is empty.
I tried:
COUNTIF(JOBS!$C$1:$C$10000,$B$4)+COUNTIF(JOBS!$L$1:$L$10000,">="&$B$5)+COUNTIF(JOBS!$L$1:$L$10000,"<="&$B$6)
The formula works fine if only one cell /B4:B6/ is filled but the data overlaps if 2 or more are filed.
Use wildcards when empty:
=COUNTIFS(JOBS!$C$1:$C$10000,IF($B$4="","*",$B$4),JOBS!$L$1:$L$10000,">="&IF($B$5="",0,$B$5),JOBS!$L$1:$L$10000,"<="&IF($B$6="",99999,$B$6))
In fact the formula I am using looks very weird. The positions of criteria and range appeared to be switched.
The original formula looks like this:
COUNTIFS($B$4,JOBS!$C$1:$C$10000,$B$5,<="&JOBS!$L$1:$L$10000,$B$6,">="&JOBS!$L$1:$L$10000)
And it is working fine, apart from the problem I mentioned in the title.
Thanks to the idea Scott gave me I have rewritten my formula and now it looks like this:
COUNTIFS($B$4,IF($B$4="","",JOBS!$C$1:$C$10000),$B$5,IF($B$5="","","<="&JOBS!$L$1:$L$10000),$B$6,IF($B$6="","",">="&JOBS!$L$1:$L$10000))
Although, I am not sure if this is the right way the formula should be written, it works great and my problem is now solved.

Combining IFERROR and LEFT Formulas

I have a formula that looks like this
=IFERROR(B83,"OPEN")
So if a certain cell has an error it changes it to OPEN, but if it doesn't then it returns the values within that cell.
I am trying to make the cell also short the text that is being returned to 7 characters.
I made this formula:
IFERROR(B83,"OPEN"),AND(LEFT(B83,7))
However it does not work and instead returns an "NA".
Appreciate any help.
Try
IFERROR(LEFT(B83,7),"OPEN")
You need to put your desired result as the first argument of IFERROR.

Inserting an INDIRECT into another formula to replace fixed values

I'm trying to do the following.
Take a value in a defined cell
Look up that value on another sheet called 'Updates'.
Look across the row for the last non-empty cell
Look up from there and return the header.
I know that if there was a defined range, the following formula works great for the last two steps.
=LOOKUP(2,1/(Updates!B3:E3<>0),Updates!B2:E2)
However I tried to make it more flexible with INDIRECT and came up with the abomination of a formula which I intended to just copy down.
=LOOKUP(2,1/INDIRECT("Updates!B"&B5+2&":S"&B5+2<>0),Updates!$B$2:$S$2)
However this just returns a #REF error. Is this type of thing not possible or is there a simpler way to go about it?
Thanks
I think you're not closing the INDIRECT statement before making the <>0 test - so move that bracket to the left and it should work; ie
= LOOKUP(2,1/INDIRECT("Updates!B"&B5+2&":S"&B5+2) <>0, Updates!$B$2:$S$2)

Resources