Hi everyone,
I am currently dealing with the following excel formula problem. I have included the workfile for convenience.
To explain the workfile, it includes data on the number of computers used per capita. To illustrate, the United Kingdom had in the year 2002 0,40082… computers per capita.
My goal is to see how many years the United Kingdom (and all other countries in the excel file) lag behind (or are ahead) of the United States.
So, if this number is compared to the United States, one can see that the value 0,40082 of the United Kingdom in 2002 is closest to the value 0,4067 of the United States (year=1997). In other words, the United Kingdom lags 5 years (2002 - 1997) = 5.
So what should the formula do? It should compare the computers used per capita of every country for every single year in the workfile (C-column) to the United States (C-column completely at the bottom of the workfile). Then, it should see which year this is for the UK and the US and report the difference. The lag is positive if the US uses more computers per capita and negative if the US uses less computers per capita.
A restricting remark is that the value of for example the UK (and all other countries in the workfile) should lie between the lowest and highest value of the US. To illustrate, Argentina in 1988 used 0,0044 computers per capita, this value is never between the lowest and the highest value of the US and so it wouldn’t make sense if the formula reported a number. There is just no data to compare it to the US as it doesn’t lie within the interval (lowest, highest value of the US). Basically, the data of the United States is the restricting part as every country is compared to the US. View attachment workfile.xlsx
I hope some of you can help me out, I tried to explain it as clear as possible. I’m just stuck. When I finally have a formula that works, I will also try to incorporate a tolerance level (+/-), but I first want to make sure the formula works.
Thanks in advance,
I am currently dealing with the following excel formula problem. I have included the workfile for convenience.
To explain the workfile, it includes data on the number of computers used per capita. To illustrate, the United Kingdom had in the year 2002 0,40082… computers per capita.
Code:
[TABLE="width: 367"]
[TR]
[TD="width: 209"]country_name[/TD]
[TD="width: 35"]year[/TD]
[TD="width: 123"]computer_percapita[/TD]
[/TR]
[TR]
[TD="width: 209"]United Kingdom[/TD]
[TD="width: 35"]2002[/TD]
[TD="width: 123"]0,400827706[/TD]
[/TR]
[/TABLE]
My goal is to see how many years the United Kingdom (and all other countries in the excel file) lag behind (or are ahead) of the United States.
So, if this number is compared to the United States, one can see that the value 0,40082 of the United Kingdom in 2002 is closest to the value 0,4067 of the United States (year=1997). In other words, the United Kingdom lags 5 years (2002 - 1997) = 5.
Code:
[TABLE="width: 367"]
[TR]
[TD]country_name[/TD]
[TD="align: right"]year[/TD]
[TD="align: right"]computer_percapita[/TD]
[/TR]
[TR]
[TD]United States[/TD]
[TD="align: right"]1996[/TD]
[TD="align: right"]0,364269227[/TD]
[/TR]
[TR]
[TD]United States[/TD]
[TD="align: right"]1997[/TD]
[TD="align: right"]0,406704277[/TD]
[/TR]
[TR]
[TD]United States[/TD]
[TD="align: right"]1998[/TD]
[TD="align: right"]0,458306998[/TD]
[/TR]
[/TABLE]
So what should the formula do? It should compare the computers used per capita of every country for every single year in the workfile (C-column) to the United States (C-column completely at the bottom of the workfile). Then, it should see which year this is for the UK and the US and report the difference. The lag is positive if the US uses more computers per capita and negative if the US uses less computers per capita.
A restricting remark is that the value of for example the UK (and all other countries in the workfile) should lie between the lowest and highest value of the US. To illustrate, Argentina in 1988 used 0,0044 computers per capita, this value is never between the lowest and the highest value of the US and so it wouldn’t make sense if the formula reported a number. There is just no data to compare it to the US as it doesn’t lie within the interval (lowest, highest value of the US). Basically, the data of the United States is the restricting part as every country is compared to the US. View attachment workfile.xlsx
Code:
[TABLE="width: 367"]
[TR]
[TD="width: 209"]country_name[/TD]
[TD="width: 35, align: right"]year[/TD]
[TD="width: 123, align: right"]computer_percapita[/TD]
[/TR]
[TR]
[TD="width: 209"]Argentina[/TD]
[TD="width: 35, align: right"]1988[/TD]
[TD="width: 123, align: right"]0,004400249[/TD]
[/TR]
[/TABLE]
Code:
[TABLE="width: 367"]
[TR]
[TD="width: 209"]country_name[/TD]
[TD="width: 35, align: right"]year[/TD]
[TD="width: 123, align: right"]computer_percapita[/TD]
[/TR]
[TR]
[TD="width: 209"]United States[/TD]
[TD="width: 35, align: right"]1980[/TD]
[TD="width: 123, align: right"]. (no data available)[/TD]
[/TR]
[TR]
[TD="width: 209"]United States[/TD]
[TD="width: 35, align: right"]1981[/TD]
[TD="width: 123, align: right"]0,009198712[/TD]
[/TR]
[TR]
[TD="width: 209"]United States[/TD]
[TD="width: 35, align: right"]....[/TD]
[TD="width: 123, align: right"]....[/TD]
[/TR]
[TR]
[TD="width: 209"]United States[/TD]
[TD="width: 35, align: right"]2002[/TD]
[TD="width: 123, align: right"]0,670255482[/TD]
[/TR]
[TR]
[TD="width: 209"]United States[/TD]
[TD="width: 35, align: right"]2003[/TD]
[TD="width: 123, align: right"]. (no data available)[/TD]
[/TR]
[/TABLE]
I hope some of you can help me out, I tried to explain it as clear as possible. I’m just stuck. When I finally have a formula that works, I will also try to incorporate a tolerance level (+/-), but I first want to make sure the formula works.
Thanks in advance,