Google Sheets – Historic currency conversion rates

Software:
Google Sheets

This is slightly off-topic in this blog, but since this subject has seriously baffled me, I decided to document and share the solution.

Getting a currency conversion rate in into a Google Sheets expression is fairly simple:

The expression:

GoogleFinance("CURRENCY:USDILS")

Simply returns the current conversion rate, in this case between US Dollars – “USD” to Israeli Shekel – “ILS”, expressed as the term “USDILS”.

So what’s the problem?
When using the GoogleFinance function to retrieve a historic conversion value like so:

GoogleFinance("CURRENCY:USDILS","price","1/1/2012")

the function doesn’t return the numeric value of the price, but instead, creates a table (see image below):

This seems like a nice feature.. so what’s the problem?
If you need to use the conversion rate within a larger scope calculation, the return value will be the string “Date” instead of a numeric value representing the conversion rate, and that will cause an error:

330*index(GoogleFinance("CURRENCY:USDILS","price","1/1/2012"),2,2)

So.. what’s the solution?
The solution is to use the index function to retrieve the wanted value from the table returned by GoogleFinance.
In this case index(weird_surprising_tabel,2,2) returns the wanted value:

330*index(GoogleFinance("CURRENCY:USDILS","price","1/1/2012"),2,2)

That’s it.
Hope you’ll find this useful! 🙂

P.S.
I do use Google Sheets for subjects directly related to CG work, and I should definitely bring some examples of that here in this blog.

UE4 – RemapValueRange Node

Software:
Unreal Engine 4.24

Having to remap a value range is very common in designing shaders, whether it’s to perform a traditional “levels” operation on a texture, or use just a specific range of values in a float input.
The RemapValueRange node let’s us do just that. this node has 5 inputs:

  1. Input: The input value
  2. Input Low: Input mapping range minimum
  3. Input High: Input mapping range maximum
  4. Target Low: Output range minimum
  5. Target Height: Output range maximum

Mono Noise examples:

  1. The original noise pattern:0
  2. Mapping input 0 -> 1 to output 0 -> 1 obviously has no effect:1
  3. Mapping input 0 -> 1 to output 0.3 -> 0.7 reduces the pattern contrast:2
  4. Mapping input 0.3 -> 0.7 to output 0 -> 1 increases the pattern contrast:3
  5. Mapping input 0 -> 1 to output 1 -> 0 inverts the pattern:4

In this example RemapValueRange nodes are applied to a texture’s individual color channels to increase contrast (Levels):
> Note that this operation can be performed using a simpler graph by using float3d adding and multiplication operations on the texture color (this will be a subject for a different post)
> Note that a different remapping operation can be performed on each color channel of a texture to adjust its color balance.

Before the value remapping:5

After the value remapping tha value in each channel 0.1 -> 0.9 to 0.0 to 1.0:6

The same operation performed by multiplication by 1.2 and subtracting 0.1:7.jpg