Relationship between tables doesn't seem to work for some values

Waimea

Active Member
Joined
Jun 30, 2018
Messages
465
Office Version
  1. 365
Platform
  1. Windows
Hi, I have two tables, one data table and one lookup table.

However, the lookup table doesn't seem to work for all values of the lookup table below:

Code:
[TABLE]
<tbody>[TR]
[TD]0[/TD]
[/TR]
[TR]
[TD][B]1-5[/B][/TD]
[/TR]
[TR]
[TD][B]6-15[/B][/TD]
[/TR]
[TR]
[TD]16-19[/TD]
[/TR]
[TR]
[TD]20-29[/TD]
[/TR]
[TR]
[TD]30-39[/TD]
[/TR]
[TR]
[TD]40-49[/TD]
[/TR]
[TR]
[TD]50-64[/TD]
[/TR]
[TR]
[TD]65-74[/TD]
[/TR]
[TR]
[TD]75-79[/TD]
[/TR]
[TR]
[TD]80-89[/TD]
[/TR]
[TR]
[TD]90-w[/TD]
[/TR]
</tbody>[/TABLE]

For lookup table value of 1-5 and 6-15 the relationship doesn't seem to work and the values gives me a total instead of a part of a sum. I am thinking that this could be because of sorting or something similar to that.

Is there any workaround for this?
r6QQG1y
In the image below, the 6-15 should give me 5235 and it gives me 44955 and I don't know why??
r6QQG1y


https://ibb.co/r6QQG1y

r6QQG1y
 
Last edited:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Any suggestions on how to fix this problem? It really bothers me that I can't figure out why the lookup doesn't work!
 
Upvote 0
ABC
CityAge
City (Suburb 1)
City (Suburb 1)1-5
City (Suburb 1)6-15
City (Suburb 1)16-19
City (Suburb 1)20-29
City (Suburb 1)30-39
City (Suburb 1)40-49
City (Suburb 1)50-64
City (Suburb 1)65-74
City (Suburb 1)75-79
City (Suburb 1)80-89
City (Suburb 1)90-w

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]2017[/TD]

[TD="align: center"]14[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]1135[/TD]

[TD="align: center"]15[/TD]

[TD="align: right"]4395[/TD]

[TD="align: center"]16[/TD]

[TD="align: right"]5455[/TD]

[TD="align: center"]17[/TD]

[TD="align: right"]1835[/TD]

[TD="align: center"]18[/TD]

[TD="align: right"]14265[/TD]

[TD="align: center"]19[/TD]

[TD="align: right"]15155[/TD]

[TD="align: center"]20[/TD]

[TD="align: right"]8720[/TD]

[TD="align: center"]21[/TD]

[TD="align: right"]10515[/TD]

[TD="align: center"]22[/TD]

[TD="align: right"]5105[/TD]

[TD="align: center"]23[/TD]

[TD="align: right"]1475[/TD]

[TD="align: center"]24[/TD]

[TD="align: right"]1645[/TD]

[TD="align: center"]25[/TD]

[TD="align: right"]410[/TD]

</tbody>

Column A is city name, column B is the same as my lookup table, column C is the population in that age group.

The lookup table works for age 0, 16-19, 20-29, 30-39, 40-49, 50-64, 65-74, 75-79, 80-80 and 90-w.

It doesn't work for age 1-5 and 6-15.
 
Last edited:
Upvote 0
Could age 1-5 and 6-15 be interpreted as dates?

Change the set up like below:



Book1
ABCD
1CityAge2017
14City (Suburb 1)01135
15City (Suburb 1)154395
16City (Suburb 1)6155455
17City (Suburb 1)16191835
18City (Suburb 1)202914265
19City (Suburb 1)303915155
20City (Suburb 1)40498720
21City (Suburb 1)506410515
22City (Suburb 1)65745105
23City (Suburb 1)75791475
24City (Suburb 1)80891645
25City (Suburb 1)90w410
Sheet1
 
Last edited:
Upvote 0
Hi Aladin,

I have changed my setup as per your very clever suggestion!

I am using PowerPivot but I am unsure how to set up my lookup table?

Code:
2017 1-5:=CALCULATE([Population 2017] ;'Age'[Age] >="1" && 'Age'[Age] <="5")
 
Upvote 0
I got it to work. Thank you very much Aladin!

Your suggestion is really good and clever!
 
Upvote 0
If someone has the time, please show me how to set up my lookup tablesfor this set up??
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top